jalf
jalf

Reputation: 585

Multiple Uploadifive in one page is not working

Hello I take my chances here at stack, because uploadify forums is not very responsive and full of spam,

I am using uploadifive w/ drag and drop it was amazing but multiple upload buttons in one page is not working. Below is my code:

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);
        }
    });

Upvotes: 0

Views: 1787

Answers (3)

zoltanradics
zoltanradics

Reputation: 21

Set different 'queueID' for each or don't set 'queueID' at all.

Upvotes: 0

Chris Dowdeswell
Chris Dowdeswell

Reputation: 868

You have passed two arguments to the onUploadComplete function.

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

There is only one argument available "file", not data.

rather annoyingly there appears to be a bug in uploadifive.

The only event functionality that returns data is:

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

However that hasn't been included in the js file.

post a support request maybe?

Upvotes: 1

RonnieSan
RonnieSan

Reputation: 182

You have to make the queueIDs different on each one. They're trying to use the same element as a queue.

Upvotes: 0

Related Questions