Topic: uploader.removeFile()?

Hi guys,

When I try to call removeFile() during an upload, I get an error.

"Uncaught TypeError: Cannot read property 'status' of undefined" in the Flash .js file (Using the latest 1.5.1.1)

I've tried both these methods:

del.click(function() {
    var idx = $('#'+file.id).data('plupload-idx'); // This contains the idx - this is a hack I tried
    uploader.splice(idx, 1);

    $('#'+file.id).hide(250, function() {
        $(this).remove();
    });
});

// Or alternatively

del.click(function() {
    uploader.removeFile(uploader.getFile(file.id)); // file.id is set correctly

    $('#'+file.id).hide(250, function() {
        $(this).remove();
    });
});

And both of them trigger the same error. I'm sure it's something I've missed that's simple!

Any help would be GREATLY appreciated - thanks very much,

Re: uploader.removeFile()?

Currently you can't stop, and shouldn't remove, the file that is currently being uploaded.  If an upload is stopped it only applies to the remaining files, not the one that is in the process of being uploaded.

Re: uploader.removeFile()?

Hi,

In that case, can I cancel the current upload process and *then* remove, and then resume from the next file?

The idea is basically that people select their files and they automatically start uploading, but they can remove them if they wish.

Thanks for the really quick response!

Re: uploader.removeFile()?

No, once a file starts uploading it needs to finish either the current chunk (if you've got chunking turned on) or the current file (if chunking is off).  I think there is a plan in the works to change this for the major rewrite of plupload that has been in the works for the last 8 or 9 months, but I don't know when that will be released.

You can stop the upload process and rearrange any remaining files however  (remove them, rearrange them, whatever).  Although there is a minor ambiguity with the html5 runtime and the queue when stopping uploads:

https://github.com/moxiecode/plupload/pull/408