You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to add a hook I can use when the upload is complete? I want to auto-submit the form as soon as it's done.
I can't add a change event to the file-url being set, since it's a hidden. So I've implemented a simple work-around -- checking if the url has a value, and trying every second once the file-input has been set. I did it simply with timeouts, though I'm sure I could have done it more elegantly with promises.
`
var maxChecksForUploadComplete = 360;
var submitFormOnceS3UploadIsComplete = function() {
if ($('.file-url').val()) {
return uploader.submitForm();
}
else if (maxChecksForUploadComplete) {
maxChecksForUploadComplete--;
return setTimeout(submitFormOnceS3UploadIsComplete, 1000)
}
else { //too many tries, exit the recursive loop
return;
}
}
Is it possible to add a hook I can use when the upload is complete? I want to auto-submit the form as soon as it's done.
I can't add a change event to the file-url being set, since it's a hidden. So I've implemented a simple work-around -- checking if the url has a value, and trying every second once the file-input has been set. I did it simply with timeouts, though I'm sure I could have done it more elegantly with promises.
`
var maxChecksForUploadComplete = 360;
var submitFormOnceS3UploadIsComplete = function() {
if ($('.file-url').val()) {
return uploader.submitForm();
}
else if (maxChecksForUploadComplete) {
maxChecksForUploadComplete--;
return setTimeout(submitFormOnceS3UploadIsComplete, 1000)
}
else { //too many tries, exit the recursive loop
return;
}
}
$('.file-input').change(submitFormOnceS3UploadIsComplete);
`
The text was updated successfully, but these errors were encountered: