jquery-iframe-transport icon indicating copy to clipboard operation
jquery-iframe-transport copied to clipboard

Add support for cross domain uploads

Open littlewiki opened this issue 13 years ago • 6 comments

I am trying to upload files to another domain(amazon s3). Amazon s3 can be made to set a 303 redirect to another url where I am returning a textarea as per the documentation. This is working in browsers except IE8 where I am getting an access denied. The line indicated by the debugger is

var doc = this.contentWindow ? this.contentWindow.document :

I am using a slightly older version of your plugin but the lines indicated have not been changed. This is how a typical form looks like :

<form enctype="multipart/form-data" method="post" action="http://flosadasXXX.s3.amazonaws.com/" id="upload" class="" target="">
<input type="hidden" name="key" value="p9B2Jq0kEeCn1QAW6paCyA/d0tbgrIgEeC_xAAW6paCyA">
<input type="hidden" name="signature" value="vPS750BKR8lt4aIPYpWR759L1Os=">
<input type="hidden" name="AWSAccessKeyId" value="AKIAJE7UXTTTQ">
<input type="hidden" name="policy" value="eyJleHBpcmF0aW9uIjogIjIwMTEtMDctMTlUMTc6NDI6MTNaIiwKImNvbmRpdGlvbnMiOiBbeyJ4LWFtei1tZXRhLXVpZWyJjb250ZW50LWxlbmd0aC1yYW5nZSIsIDAsIDEwNDg1NzYwXSx7ImJ1Y2tldCI6ICJmbG9ja2VkaW5uZXN0LmxpdHRsZXdpa2kuaW4ifSx7ImtleSI6ICJwOUIySnEwa0VlQ24xUUFXNnBhQ3lBL2QwdGJncklnRWVDX3hBQVc2cGFDeUEifSx7InN1Y2Nlc3NfYWN0aW9uX3JlZGlyZWN0IjogImh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC9maWxlL3VwZGF0ZSJ9XX0=">
<input type="hidden" name="success_action_redirect" value="http://localhost:8000/file/update">
<input type="hidden" name="x-amz-meta-fileId" value="d0tbgrIgEeC_xAAW6paCyA">
<input type="hidden" name="content-type" value="text/plain">
<input type="hidden" name="x-amz-meta-filename" value="rcpts_edit.txt">
<input type="hidden" name="x-amz-meta-uid" value="p9B2Jq0kEeCn1QAW6paCyA">
<span class="file-overlay">
<input type="file" size="1" name="file" id="file-attach-input">
</span>
<button title="Attach a file" type="button" class="button" id="file-share">
<img alt="Attach a file" src="/rsrcs/img/attach.png">
</button>
<!--<input type="submit" value="Submit"/>-->
<input type="hidden" name="X-Requested-With" value="IFrame"></form>

Let me know if you need more information.

Thanks, Abhi

littlewiki avatar Jul 19 '11 16:07 littlewiki

The issue occurs when the remote server on the other domain (s3) returns a 4XX.

littlewiki avatar Jul 20 '11 11:07 littlewiki

were you able to get a workaround for this?

madhums avatar Apr 24 '12 17:04 madhums

I get this when the response back from the server is not valid html, as the iframe contents cannot be parsed by the browser. It can be easily fixed by adding extra checks to see if the root variable on line 183 is null

iainbeeston avatar Jul 31 '12 05:07 iainbeeston

Hi, I am using this plugin indirectly (via blueimp's file upload plugin) I'm also having IE8 cross domain issues. Was wondering if there is a known solution /workaround ?

ediweissmann avatar Nov 15 '12 20:11 ediweissmann

I am using the plugin directly in FF on a Mac and am trying to find an answer to this as well. I am running a local server but the file upload API is remote. Any other solutions other than customizing the plugin?

santhony7 avatar Apr 09 '13 20:04 santhony7

I'm not sure, but I'm wondering if it'd help if iframe-transport allowed setting the iframe's document.domain.

JangoSteve avatar Jul 06 '13 16:07 JangoSteve