Handling NewFileStream

3 posts, 0 answers
  1. Eric Schoenholzer
    Eric Schoenholzer avatar
    138 posts
    Member since:
    Mar 2004

    Posted 18 Apr 2011 Link to this post

    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. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 21 Apr 2011 Link to this post

    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
  3. DevCraft banner
  4. Eric Schoenholzer
    Eric Schoenholzer avatar
    138 posts
    Member since:
    Mar 2004

    Posted 21 Apr 2011 Link to this post

    Thanks, now the link worked and the example was useful.

    Eric
Back to Top