Javascript upload in spite of same origin policy

Posted by Brian M. Hunt on Stack Overflow See other posts from Stack Overflow or by Brian M. Hunt
Published on 2010-04-20T18:09:10Z Indexed on 2010/04/20 18:13 UTC
Read the original article Hit count: 530

Can one upload files to a domain other than the domain a script originates from?

For example, suppose you're hosting files on www.example.com, and you want to upload files to uploads.example.com, would the following script violate the same origin policy (using uploadify):

<!-- from http://www.example.com/upload.html -->
<input id="fileInput" name="fileInput" type="file" />
<script type="text/javascript">// <![CDATA[
$(document).ready(function() {
  $('#fileInput').uploadify({
    'uploader'  : 'uploadify.swf',
    'script'    : 'http://upload.example.com/uploadify.php',
    'cancelImg' : 'cancel.png',
    'auto'      : true,
    'folder'    : '/uploads'
  });
});
// ]]></script>

I haven't seen a clear reference on the same origin policy that would indicate one-way or the other whether the this would be an issue with any browsers.

© Stack Overflow or respective owner

Related posts about same-origin-policy

Related posts about JavaScript