cmlenz/jquery-iframe-transport

Add support for cross domain uploads

Opened this issue · 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

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

were you able to get a workaround for this?

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

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 ?

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?

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