PHP/JavaScript的多重上传 [英] Multiupload with PHP/JavaScript

查看:51
本文介绍了PHP/JavaScript的多重上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有解决方案可以一次上传多个文件而不使用Flash? :)

Are there any solutions to upload multiple files at once without flash? :)

不是那样:选择一个文件,转到库存,选择第二个文件,转到库存,然后上传.但是请立即选择所有需要的文件并上传.

Not like that: choose one file, it goes to the stock, choose second file, it goes to the stock and than upload. But choose at once all needed files and upload them.

推荐答案

HTML5通过在输入中指定"multiple"属性来支持多个文件.

HTML5 supports multiple files, by specifying the "multiple" attribute on the input.

为输入提供一个以方括号结尾的name属性(即"myfileinput []"),在PHP中,它看起来与在页面上有两个称为同一事物的输入完全相同.

Give the input a name attribute ending in square brackets (i.e. "myfileinput[]") and it will appear to PHP exactly the same as if there were two inputs called the same thing on the page.

这显然在旧版浏览器中不起作用,但是可以通过JS检测到缺少对多个文件上传的支持,而通过JS创建了多个文件输入.

This obviously doens't work in legacy browsers, however lack of support for multiple file uploads could be detected via JS, and multiple file inputs created via JS.

这篇关于PHP/JavaScript的多重上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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