0

cross domain file upload from javascript with yql

Hi I want to upload a file from javascript to a different domain.To make the cross domain requests I am using yahoo query language yql .I am also using the jquery form plugin

<form id="myForm" method="post" action="https://upload.box.net/api/1.0/upload/<my auth token>/0">
       
<p>Upload File</p>
       
<input type="file" class="upload_file_input"/><br><br>
       
<input type="submit" value="Upload"/>
</form>

<script>
    $('#myForm').ajaxForm(function() {
                alert("File uploaded successfully");
    });
<script>

This is not working due to cross domain restrictions.As a workaround I have to use yql.I am able to do cross domain get requests using yql,but I don't know How to do post ,especially with file upload using yql.Please help.

by
1 Reply
  • I think your question need more explanation, to understand better please let us know how you achieved cross domain Get.

    Cross domain POST in restricted by browser. you might have to do some Hack here, YQL is not going to help you in cross domain post, you need a some kind of hook from server.

    I have explained one such cross domain post API design example here

    Cross domain Get is mostly achieved by JSONP. i.e to successfully get cross domain data you should be some way able to have a callback in the response JSON.

    I recommend you to read my article thoroughly.

    Some More Thing

    1. JSON Hijacking http://haacked.com/archive/2009/06/24/json-hijacking.aspx
    1

Recent Posts

in YQL