在 ASP.NET 中选择要上传的多个文件(最好不使用 flash) [英] select multiple files to upload in ASP.NET (preferably without flash)

查看:25
本文介绍了在 ASP.NET 中选择要上传的多个文件(最好不使用 flash)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有允许从文件打开对话框中选择多个文件并从 ASP.NET 网页上传它们的解决方案?我已经浏览过与此相关的以前的帖子,但想知道是否可以在不使用 flash 或 silverlight 等技术的情况下选择多个文件进行上传?提前致谢.

is there a solution that allows to select multiple files from the file open dialog box and upload them from ASP.NET web page? I have gone through previous posts related to this, but wondering if it is possible to select multiple files for upload without using the technologies like flash or silverlight? thanks in advance.

更新:需要明确的是,我需要通过按 shift 或 control 键一次在对话框中选择一个文件夹中的多个文件.flash 上传控件允许这样做,但我正在寻找一个没有 flash 的.看起来这是一个限制,如果不使用 flash 或 activex 控件是不可能的.

UPDATE: to be clear, I need to select multiple files in a folder in the dialog box at once, by pressing shift or control key. the flash upload controls allow this, but I am looking for one without flash. it looks like this is a limitation and not possible without using flash or activex controls.

推荐答案

HTML5 可以为文件的标准输入标签提供一个附加属性:multiple.

It's possible with HTML5 which gives the standard input tag for files an additional attribute: multiple.

实现后如下所示:

<input type="file" id="input" multiple="true" />

...并准确地为您提供所需的内容.

...and give you exactly what you're looking for.

如果你加入一些普通的 Javascript,你甚至可以流式传输文件.

If you toss in some vanilla Javascript, you can even stream the upload of the file(s).

http://blog.new-bamboo.co.uk/2010/7/30/html5-powered-ajax-file-uploads

两个缺点是:

  1. 这仅适用于支持 HTML5 (FF/Chrome/Opera/Safari) 的浏览器.您仍然需要针对各种 IE 的解决方案.
  2. 显示的示例说明了如何在 PHP/Ruby/Django 环境中处理流文件.您必须弄清楚如何以 .Net 方式读取上传的文件.

我希望这会有所帮助,或者至少能让你走上正确的道路.

I hope this helps or at least puts you on the right path.

这篇关于在 ASP.NET 中选择要上传的多个文件(最好不使用 flash)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆