Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC server-side file upload progress calculator

I am trying to implement basic progress bar for file uploads to work across multiple browsers without additional plugins like Flash or Silverlight. There are multiple ways to approach this problem on a client-side, however I can't find anything to work on a server.

Anywhere on MVC controller (before/on authorization and before/on executing action) file is already uploaded to server as HttpPostedFileBase. If I use basic HTTP handler for form submission, I have access to Context.Request.InputStream as well as to Context.Request.Files, but as soon I access the properties the stream/files would load silently.

I did extensive research, but could not find anything what allows me to Cache or store file upload process in Session. That would at least allowed me to use periodic AJAX requests from a client to monitor the progress.

What am I missing?

like image 265
Mikhail Smotkin Avatar asked Mar 26 '26 12:03

Mikhail Smotkin


1 Answers

You should try a Javascript alternative, instead of handling it server side. The controller should only come in action when the request is done sending.

Try this JavaScript/jQuery alternative to Flash/SL

http://blueimp.github.io/jQuery-File-Upload/

like image 81
matthijsb Avatar answered Mar 28 '26 03:03

matthijsb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!