我尝试使用jQuery-File-Upload以单一形式实现(不成功)多文件输入。该插件似乎支持这种行为:
Multiple File Input Fields in One Form
我不能让它发挥作用。什么相关的javascript使其工作?这是部分示例中的表单:
<form id="fileupload" action="php/index.php" method="POST" enctype="multipart/form-data">
<div class="row">
<div class="span16 fileupload-buttonbar">
<div class="progressbar fileupload-progressbar"><div style="width:0%;"></div></div>
<span class="btn success fileinput-button">
<span>Add files...</span>
<input type="file" name="files[]" multiple>
</span>
<!-- Extra file input start /-->
<span class="btn fileinput-button">
<span>Other...</span>
<input type="file" name="files2[]" multiple>
</span>
<!--/ Extra file input stop -->
<button type="submit" class="btn primary start">Start upload</button>
<button type="reset" class="btn info cancel">Cancel upload</button>
<button type="button" class="btn danger delete">Delete selected</button>
<input type="checkbox" class="toggle">
</div>
</div>
<br>
<div class="row">
<div class="span16">
<table class="zebra-striped"><tbody class="files"></tbody></table>
</div>
</div>
</form>
我尝试使用js的标准实现:
$(function () {
$('#fileupload').fileupload({
dataType: 'json',
done: function (e, data) {
$.each(data.result.files, function (index, file) {
$('<p/>').text(file.name).appendTo(document.body);
});
}
});
});
有没有人有完整的工作示例?我只需要将文件组上传到php上传器。