2012-08-13 97 views
0

你好,我把我的机会,在这里堆,因为uploadify论坛是不是非常敏感,充满垃圾邮件,多Uploadifive在一个页面无法正常工作

我使用uploadifive W /拖放它是惊人的,但多在一个页面上传按钮不起作用。下面是我的代码:

HTML

<input type="file" name="file_upload_1" id="file_upload_1"/> 
<input type="file" name="file_upload_2" id="file_upload_2"/> 

JS

$('#file_upload_1').uploadifive({ 
    'auto'   : true, 
    'method'  : 'post', 
    'queueID'  : 'queue', 
    'fileType'  : ['text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel','application/force-download'], 
    'uploadScript' : 'upload.php', 
    'onUploadComplete' : function(file, data) { 
     console.log(data); 
     } 
    }); 
$('#file_upload_2').uploadifive({ 
    'auto'   : true, 
    'method'  : 'post', 
    'queueID'  : 'queue', 
    'fileType'  : ['text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel','application/force-download'], 
    'uploadScript' : 'upload.php', 
    'onUploadComplete' : function(file, data) { 
     console.log(data); 
     } 
    }); 
+0

您的id在html中需要不同。而jQuery应该使用ID。也许你......切换了'id ='和'name =',忘记输入2了? – irrelephant 2012-08-13 08:31:27

+0

嗨@irrelephant,对不起,它在这里堆叠错字,我已经编辑我的HTML。上面的代码不起作用。 – jalf 2012-08-13 08:35:29

+0

@jalf,现在去编辑 – Alexander 2012-08-13 08:44:11

回答

0

你必须让queueIDs在每一个不同的。他们试图使用相同的元素作为队列。

+0

谢谢RonnieSan我已经尝试更改queueID,但仍然无法正常工作 – jalf 2012-08-15 08:09:19

1

您已将两个参数传递给onUploadComplete函数。

'onUploadComplete' : function(file, data) { 
    console.log(data); 
} 

只有一个参数可用“文件”,而不是数据。

相当恼人的是在uploadifive中似乎有一个bug。

返回 data

的唯一事件功能:

'onUploadSuccess' : function(file, data, response) { 
      alert('The file ' + file.name + ' was successfully uploaded with a response of ' + response + ':' + data); 
     } 

但尚未列入js文件。

发布支持请求也许吗?

0

为每个设置不同的'queueID'或根本不设置'queueID'。