digitarald-fancyupload icon indicating copy to clipboard operation
digitarald-fancyupload copied to clipboard

Patches for iframe-based uploads to Amazon S3

Open evansd opened this issue 13 years ago • 0 comments

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!

evansd avatar Apr 15 '11 11:04 evansd