digitarald / digitarald-fancyupload

Swiff meets Ajax for powerful and elegant uploads (MooTools Plugin).
http://digitarald.de/project/fancyupload/
277 stars 105 forks source link

Patches for iframe-based uploads to Amazon S3 #18

Open evansd opened 13 years ago

evansd commented 13 years ago

Hi, I've been using your iframe-based uploader to send files to Amazon S3 direct from the browser and I've had to make a couple of small patches.

The first was to move the file input to the end of the form so that the file is the last field submitted: Amazon insist on this as they want to process your credentials and object parameters before they start processing your file data.

The second was to work around cross-domain iframe errors. If the upload is successful Amazon redirect the browser to a URL of your choosing so everything works fine. If the upload fails, however, Amazon don't redirect and so the iframe onLoad code throws a permission denied error when trying to read the iframe properties. I've wrapped this in a try ... catch and just create an empty file.response object if there's an error. You might have a better suggestion for how to handle this condition, but I think it's preferable to catch the error and let the calling code deal with it than to let it propagate.

Thanks for the awesome library!