没有Flash / .NET,为什么多文件上传不简单?

我在网上看到的唯一允许通过单个对话框选择上传多个文件的工具/插件 使用SHIFT或CTRL单击操作的框(而不是单击文件上传的单个文件)存在于Flash / .NET / Java中的控件,而不仅仅是直接的Javascript / HTML / PHP。</ p>
\ n

为什么会这样? 我想如果可能的话,网站开发人员会希望减少对不同技术的依赖,而不是更多。</ p>
</ div>

展开原文

原文

The only tools/plugins I've seen online that allow for multiple files to be selected for upload through one single dialog box using a SHIFT or CTRL click action (as opposed to clicking on a single file per for file uploads) exist for controls made in Flash/.NET/Java, not just straight Javascript/HTML/PHP.

Why is that the case? I'd imagine that if possible, site developers would look to having less dependencies on different technologies rather than more.

2个回答



这是一个很老的问题,所以需要一些更新。 随着HTML5,它变得越来越好。 &lt; input ...&gt;的新属性'multiple' 至少当前版本的Firefox和Google Chrome已经支持tag。 现在我们只需要等待IE赶上...... </ p>
</ div>

展开原文

原文

It is quite old question, so needs some update. With HTML5 it is getting better. New attribute 'multiple' for <input...> tag is already supported by at least current versions of Firefox and Google Chrome. Now we just need to wait for IE to catch up...



这是因为HTML &lt; input type =“file”&gt; </ code>元素只能包含一个文件 根据规格 - 通过它上传多个文件根本不可能。 并且Javascript不能伪造多文件上传框,因为文件选择对话框是由浏览器实现的,并且根据规范,只允许选择一个文件。 Javascript无权访问本地文件系统,因此无法替换该对话框。</ p>
</ div>

展开原文

原文

That's because a HTML <input type="file"> element can only contain one file as per per spec - it's simply impossible to upload multiple files through it. And Javascript cannot fake a multi-file upload box because the file selection dialog is implemented by the browser and, as per spec, allows only one file to be selected. Javascript does not have access to the local file system and thus cannot replace that dialog.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐