Getting early control of a large file upload request
I need to create a proxy-like solution that "forwards" an uploaded file to somewhere else. The problem I am facing is that with large uploads the file needs to be fully uploaded before my forwarding code gets control of it in Page_Loaded
of an ASP.NET
application.
Is there a way to get control of a Stream
of a file being uploaded as soon as the upload begins? The idea is to start forwarding as soon as first file bytes start coming in without wai开发者_运维技巧ting for the entire upload to finish.
Can IHttpModule
be used to achieve this goal?
Some time ago, I had to deal with images and some heavy files upload. We used this project: http://silverlightfileupld.codeplex.com/
It is basically a silverlight file uploader, we added some feautures like image compression. Also the key part, is that we used this uploader to send chunks of the file instead of the whole file, so the new file was recreated as a temp file and then renamed. Maybe you can follow that approach and in the ashx file, you can transfer the bytes to the real server.
Hope this helps
精彩评论