2012-08-13 21 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'。

相關問題