I’m looking to allow a user to browse and upload a file to the server in my ASP.NET MVC application.
If it is possible, I’m interested in adding a progress bar to show how much of the file has been uploaded.
Does anyone have any examples of something like this? Should I use jQuery to do this?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
The beauty of ASP.NET MVC is that you can choose almost any out of the box upload component out there and use it without any problems.
This plugin for jQuery is a great choice and one that I use in my projects:
Uploadify
Method 2
Steve Sanderson put some examples on his blog awhile back that I found helpful. He has the source code available as well.
Method 3
Uploadify is nice, but we can’t use Flash, so we are using Darren Johnstone’s file upload control:
ASP.Net File Upload/Download Module Version 2
http://darrenjohnstone.net/2008/07/15/aspnet-file-upload-module-version-2-beta-1/
It includes a progress bar dialog driven entirely with Javascript, and even has the capability to upload and download files directly to a SQL Server database.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0