This is a migrated thread and some comments may be shown as answers.

Handling NewFileStream

2 Answers 43 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Eric Schoenholzer
Top achievements
Rank 2
Eric Schoenholzer asked on 19 Apr 2011, 01:00 AM
Hi, I'm trying to replace the content of a uploading file in the FileUploadStarting event.
This is my code. But it doesn't work. It seems the original file is still written.

e.NewFileStream = new MemoryStream();
using (var writer = new StreamWriter(e.NewFileStream, Encoding.UTF8))
{
    writer.Write(_model.GetXml());
    writer.Flush();
    writer.Close();
}

The idea is to write a XML file (as string) to the server.
Do you have an example how to use NewFileSream? Or what I'm doing wrong?

Thanks
Eric

2 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 21 Apr 2011, 02:17 PM
Hi Eric Schoenholzer,

Can you try the approach described in the Uploading stream KB article? You should be able to open it now. However, we also attached it in the other thread you started.

Give it a try and let us know how it goes.

Best wishes,
Tina Stancheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Eric Schoenholzer
Top achievements
Rank 2
answered on 21 Apr 2011, 02:53 PM
Thanks, now the link worked and the example was useful.

Eric
Tags
Upload
Asked by
Eric Schoenholzer
Top achievements
Rank 2
Answers by
Tina Stancheva
Telerik team
Eric Schoenholzer
Top achievements
Rank 2
Share this question
or