简体   繁体   English

通过Javascript / Ajax上传多个文件?

[英]Multiple file uploads via Javascript/Ajax?

Is there a way to select more than one files to upload when a user clicks the 'Browse' button, and have those files uploaded without refreshing the page? 有没有办法在用户点击“浏览”按钮时选择上传多个文件,并在不刷新页面的情况下上传这些文件?

This happens in Gmail, when you click to attach a file you can hold down CTRL and select multiple files. 这种情况发生在Gmail中,当您单击以附加文件时,您可以按住CTRL并选择多个文件。

there are only two ways of uploading a file without refreshing the page: 只有两种方法可以在不刷新页面的情况下上传文件:

  1. iframe IFRAME

  2. flash - it will give you the possibility to select multiple files at once 闪存 - 它可以让您一次选择多个文件

look at SWFUpload for more info 查看SWFUpload以获取更多信息

I recently faced a similar problem. 我最近遇到了类似的问题。 We had been using Uploadify (http://www.uploadify.com/) to do uploads. 我们一直在使用Uploadify(http://www.uploadify.com/)进行上传。 I wrote a blog post on how to use Uploadify to perform multiple file uploads: 我写了一篇关于如何使用Uploadify执行多个文件上传的博客文章:

http://blog.bobcravens.com/2011/03/upload-multiple-files-with-progress-using-uploadify/ http://blog.bobcravens.com/2011/03/upload-multiple-files-with-progress-using-uploadify/

There are a couple of supported options: 有几个支持的选项:

  • Use a single 'input' element and select multiple files. 使用单个“input”元素并选择多个文件。

  • Use multiple 'input' elements to select a single file each. 使用多个“input”元素分别选择单个文件。

Hope this helps. 希望这可以帮助。

Bob 短发

Check http://valums.com/ajax-upload/ it's a neat plugin! 查看http://valums.com/ajax-upload/这是一个整洁的插件!

EDIT: Added an exclamation point. 编辑:添加了感叹号。

如果你想要一些真正的跨平台使用: plupload它支持HTML4,5 ,Flash等等......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM