如何通过 ASP.NET MVC 上传文件并显示进度条?
我希望允许用户在 ASP.NET MVC 应用程序中浏览文件并将其上传到服务器。
如果可能的话,我有兴趣添加一个进度条来显示已上传文件的数量。
有人有类似的例子吗? 我应该使用 jQuery 来做到这一点吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
ASP.NET MVC 的美妙之处在于您几乎可以选择任何现成的上传组件并毫无问题地使用它。
这个 jQuery 插件是一个不错的选择,我在我的项目中使用了这个插件:
上传
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
Steve Sanderson 在他的 上举了一些例子不久前我发现博客很有帮助。 他也有可用的源代码。
Steve Sanderson put some examples on his blog awhile back that I found helpful. He has the source code available as well.
Uploadify 很好,但是我们不能使用 Flash,所以我们使用 Darren Johnstone 的文件上传控件:
ASP.Net 文件上传/下载模块版本 2
http://darrenjohnstone.net /2008/07/15/aspnet-file-upload-module-version-2-beta-1/
它包括一个完全由 Javascript 驱动的进度条对话框,甚至能够直接上传和下载文件SQL Server 数据库。
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.