moxiecode / plupload

Plupload is JavaScript API for building file uploaders. It supports multiple file selection, file filtering, chunked upload, client side image downsizing and when necessary can fallback to alternative runtimes, like Flash and Silverlight.
http://www.plupload.com
GNU Affero General Public License v3.0
5.63k stars 1.43k forks source link

Upload on "FilesAdded" event fires twice #1462

Open avramovic opened 7 years ago

avramovic commented 7 years ago

The idea is to start upload the moment files are dropped on the upload zone. But, whenever I drop a file on the #plupload div, two requests are fired to /upload. I have tried to use a flag uploadStarted thinking my code is being executed twice, but no. The alert() was added to confirm code is run only once, which is the case, but I'm still getting two requests to /upload and the files are being uploaded twice. Using v3.1.0

Here's the code I'm using:

var uploadStarted = false;

var uploader = new plupload.Uploader({
    browse_button: 'plupload',
    url: '/upload',
    filters: {
        mime_types : [
            { title : "Photos", extensions : "jpg,png,gif" }
        ],
        max_file_size: '40mb',
        prevent_duplicates: true
    }
});

uploader.init();

uploader.bind('FilesAdded', function(up, files) {

    if (!uploadStarted) {
        uploadStarted = true;
        uploader.start();
        alert('upload started');
    }
});
atgrrr commented 7 years ago

Same problem here, i don't know how to solve it.

avramovic commented 7 years ago

This happens in Chrome on MacOS Sierra. In Safari, when I drop two files, first one gets uploaded twice and second once. When I drop three files, two files get uploaded twice and third once 😕

avramovic commented 7 years ago

Just to let you know, it works fine with v.2.3.1! Didn't know v.2.3.1 was the latest stable, I have used bower to install plupload and it automatically pulled v.3.1.0

jayarjo commented 7 years ago

v.3.1.0 is marked as pre-release (not ready for production). But it is an obvious bug.

vlamirc commented 7 years ago

Same problem here. I will wait for the final v.3.1.0.

silverpresident commented 7 years ago

Same problem. 3.0-beta1 works fine but 3.0.1 causes a double upload request for each file. It happens even when chucked uploading is disabled.

burzum commented 7 years ago

Same issue here using 3.1.0, going back to another version.

Bird87ZA commented 6 years ago

Any idea on when this will be fixed? I have the same issue.

EDIT to add: 2.3.4 works fine here as well.