我已经用jquery文件上传插件(https://github.com/blueimp/jQuery-File-Upload)完成了文件上传。但是现在,我不知道如何解决这个问题:我有这样的HTML代码:
<form id="form-1"></form>
<input type="file" class="file-upload" id="file-1" name="file" form="form-1" />
<form id="form-2"></form>
<input type="file" class="file-upload" id="file-2" name="file" form="form-2" />
$('input[type="file"][name="file"].file-upload').each(function(){
var self = $(this);
$(this).fileupload({
url: window.fileUpload.uploadUrl,
dataType: 'json',
dropZone: self,
fileInput: self
});
});但问题是,当我把文件放在第一个输入上时,它会上传文件2次--每个输入。我不知道该怎么解决这个问题。你有什么解决办法吗?
编辑:我发现,上传只完成一次,但有两次被称为"fileuploaddone“事件。
解决方案: jQuery文件上传实例在一个文件输入上启动了两次。
发布于 2016-03-02 21:48:35
这是因为您没有导入jquery js文件并在<script type="text/javascript">(此处为</script>)下正确地编写代码。
https://stackoverflow.com/questions/35758589
复制相似问题