3

Uploaded files in ASP.NET are fully stored in memory by default before they can be processed by server-side code. This leads to poor scalability in server when many large files are uploaded at the same time.

The ideal solution would be some way to allow the server read the file while it's being uploaded (not only when upload is finished), or a server component that stores uploaded data temporary in a temporary file or database.

2
  • What are you using? The FileUpload control? Commented Oct 18, 2011 at 10:15
  • No ASP.NET controls, just pure multipart form upload via HTTP POST... Commented Oct 18, 2011 at 11:53

2 Answers 2

1

what you are talking about here is streaming versus buffering.

when you have a byte[] buffer = ...; line in your ASP.NET application, either for upload or download, you are doing buffering and you experience the memory issues you mentioned in your question. In fact you could sometimes call the GC directly to force release memory but there are articles, blogs, people and opinions absolutely against this.

the option with streaming is surely the best way to go, consider that SQL Server 2008 supports FILESTREAM I/O natively and streaming can be done also with WCF.

Plenty of articles online about WCF and SQL Server streaming, I can't know what exactly you need as you do not tell more details of your code and you do not show any code.

Sign up to request clarification or add additional context in comments.

Comments

0

I also needed to upload multiple large files to a server. I eventually made a WCF service and used a silverlight client to upload the files. The files were slashed in pieces of 128kb and those were uploaded. In this way I could also show a nice progres bar and if the upload was corrupt (I also send a md5 hash of the part) I can easilly upload the part again instead of having to upload the entire file again.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.