質問

I successfully integrate plupload on my website. I can upload files without problems but I cannot upload the same file multiple times.

PS: the problem only occurs with Internet Explorer. I don't have any problems with Google Chrome.

For example:

  1. I upload 'hello.jpg'
  2. The upload starts immediately
  3. When upload finished, I display an alert (no matter).
  4. Then I try to upload the same file, and it does not work. Nothing happened. I set a breakpoint in the 'FilesAdded' event and it is never reached.

BUT if I try to upload another file it is working well.

BUT if I press F5 (refresh) then i can upload the previous uploaded file.

Any idea? I really would like to be able to upload the same file multiple times.

For example, if a user upload a file then realize something is wrong inside the file and modify something in this file and need to upload it again, then he cannot upload it again in my case...

Here is part of my code:

Html part:

<div id="container">
    <a id="pickfiles" href="#" class="btn ui-button-text-icon-secondary">Uploader</a>
</div>

Javascript part:

var uploader = new plupload.Uploader({
    runtimes: 'gears,html5,flash,silverlight,browserplus',
    unique_names: false,
    browse_button: 'pickfiles',
    container: 'container',
    max_file_size: '5mb',
    url: pFiles.addFileUrl,
    multi_selection: false,
    multipart: true,
    multipart_params: { "type": "undefined" },
    filters : [{title : "Adobe PDF files", extensions : "pdf"}], 
    flash_swf_url: pFiles.uploadFlashUrl,
    silverlight_xap_url: pFiles.uploadSilverlightUrl,
    resize: { width: 320, height: 240, quality: 90 }
});

uploader.bind('FilesAdded', function (up, files) {
    uploader.state = 1;
    up.refresh(); // Reposition Flash/Silverlight
    uploader.settings.multipart_params["type"] = $('#type').val();
    uploader.start();
    up.refresh();
    $('#messages').show();
});

uploader.bind('UploadProgress', function (up, file) {
    $('#messages').html('Progression: ' + file.percent + "%");
});

uploader.bind('FileUploaded', function (up, file, response) {
    var msg = $.parseJSON(response.response).Message;
    alert(msg);
});

PS: my current version of plupload is 1.5.4

役に立ちましたか?

解決

Finally, I simply had to install the 2.0 version of plupload.

他のヒント

Try changing the following line:

unique_names: false

to

unique_names: true

From the documentation:

unique_names

Generate unique filenames when uploading. This will generate unqiue filenames for the files so that they don't for example collide with existing ones on the server.

you to call destroy() method after upload process is done. Then initiate it again

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top