xmlhttprequest - Flash crossdomain multipart POST not working? -


i'm using moxie xhr2 polyfill issue crossdomain post file upload, using formdata construct multipart request containing file object fileinput.

using html5 runtime, request successful , file uploaded. however, when using flash runtime, crossdomain.xml requested, request hits readystate 4 status of 0, suggesting request cancelled because invalid cross-domain request.

the crossdomain.xml spec mentions nothing request methods. quick search on moxie github turns this issue, seems have been resolved, although issue still open. unlike in issue, i'm not seeing any request go through after crossdomain.xml.

the code send request:

var xhr = new moxie.xmlhttprequest(); xhr.open('post', url, true); xhr.bind('load', function() {   if(this.status === 200) {     // yay!   } else {     // boo!   } });  var form = new moxie.formdata(); form.append('file', file); // file moxie.file fileinput  xhr.send(form); 

my crossdomain.xml following:

<?xml version="1.0"?> <cross-domain-policy xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xsi:nonamespaceschemalocation="http://www.adobe.com/xml/schemas/policyfile.xsd">   <allow-access-from domain="*"/> </cross-domain-policy> 

according the as3 documentation:

in flash player 10 , later, if use multipart content-type (for example "multipart/form-data") contains upload (indicated "filename" parameter in "content-disposition" header within post body), post operation subject security rules applied uploads:

  • the post operation must performed in response user-initiated action, such mouse click or key press.
  • if post operation cross-domain (the post target not on same server swf file sending post request), target server must provide url policy file permits cross-domain access.

the reason request failing first bullet point, since post isn't done "response user-initiated action, such mouse click".

quite how moxie expects me i'm not sure, (scarce) documentation indicates cross-platform multipart uploads possible.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -