-
Notifications
You must be signed in to change notification settings - Fork 252
Open
Labels
Description
I am trying to upload 2 different versions of the same file to AWS S3 from a single form: large and thumbnail.
The code for the upload is the following. The upload works fine and in the done callback I would like to start the second upload.
fileInput.fileupload({
fileInput: fileInput,
url: form.data('url'),
type: 'POST',
autoUpload: true,
formData: form.data('form-data'),
paramName: 'file', // S3 does not like nested name fields i.e. name="user[avatar_url]"
dataType: 'XML', // S3 returns XML if success_action_status is set to 201
replaceFileInput: false,
disableImageResize: false,
imageMaxWidth: 800,
imageMaxHeight: 800,
imageCrop: true,
done: function(e, data) {
console.log('DONE');
// HERE I WOULD LIKE TO MAKE A SECOND UPLOAD
startThumbnailUpload();
},
});
The code for the startThumbnailUpload() method would be exactly the same except for the width and height:
function startThumbnailUpload(){
fileInput.fileupload({
fileInput: fileInput,
url: form.data('url'),
type: 'POST',
autoUpload: true,
formData: form.data('form-data'),
paramName: 'file', // S3 does not like nested name fields i.e. name="user[avatar_url]"
dataType: 'XML', // S3 returns XML if success_action_status is set to 201
replaceFileInput: false,
disableImageResize: false,
imageMaxWidth: 200,
imageMaxHeight: 200,
imageCrop: true,
done: function(e, data) {
console.log('DONE');
},
});
}
The second fileInput.fileupload never gets executed. Is there a way to achieve that kind of double upload with the same file reusing the same fileinput?