LPology / Simple-Ajax-Uploader

Javascript file upload plugin with progress bar support. Works in all major browsers, including IE7+, Chrome, Firefox, Safari, and Opera. No dependencies - use it with or without jQuery.
995 stars 267 forks source link

How to trigger the submit() function manually? #81

Closed WonSoon closed 9 years ago

WonSoon commented 9 years ago

Hello, Tnx for this great tool!

I'd like to use "autoSubmit: false" and trigger manually with the submit() function. But I can't trigger the submit() function. (I don't know how to trigger the submit() function manually.) Could you give me the examples for using submit() function?

LPology commented 9 years ago

Yeah its pretty easy. So if you have have an instance of the uploader like this:

var my_uploader = new ss.SimpleUpload({
    autoSubmit: false
    // options
});

// Submit manually like this:
my_uploader.submit();
nrthbound commented 9 years ago

However, if you set autoSubmit to false, it doesn't build the queue list like it does when it's set to true.

I was trying to leave autosubmit on, but return false on the onSubmit action so the upload wouldn't start automatically. This way, it still builds the list (shows the files to be uploaded). The issue with this is when you use my_uploader.submit(), it doesn't start the upload, but duplicates the files names in the list for some reason.