This project is read-only.

Exception in Uploading file biggern than 2MB

Topics: faq
May 4, 2016 at 1:07 PM
Hi,

while testing the WebServer I have found an exception when uploading a file and ContentLength gets bigger than 2MB. When I understood your code, it is changing towards Filestream in this case and saving it to the temp file.
            _bodyFileName = Path.GetTempFileName();
            Body = new FileStream(_bodyFileName, FileMode.CreateNew);
Just it seems that the Temp file is already created and stream cannot write to this existing file. So I have changed:
            _bodyFileName = Path.GetTempFileName();
            Body = new FileStream(_bodyFileName, FileMode.OpenOrCreate);
Now it is working, just I am not sure I may have destroyed anything else by this change?
What do you think?

Regards,
Thorsten