What steps will reproduce the problem? 1. Create a multipart/form-data request 2. Set the mimepart according to the specification 3. Set the Content-Transfer-Encoding: base64 4. Post the data in base64 format
What is the expected output? What do you see instead? The expected output will be something different than a blank page
What version of the product are you using? On what operating system? Using google chrome the http://www.imageshack.us/upload_api.php url
Please provide any additional information below.
below the javascript method to create the xhr request with a base64 data. The dataUrl param comes from canvas.toDataUrl('image/jpeg') or canvas.toDataUrl('image/png')
var xhr = new XMLHttpRequest(); var boundaryString = '------------------------------'; xhr.open('POST','http://www.imageshack.us/upload_api.php'); //xhr.open('POST','http://localhost:8080/Upload/'); xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary="+boundaryString); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { if ((xhr.status >= 200 && xhr.status <= 200) || xhr.status == 304) { if (xhr.responseText != "") { alert(xhr.responseText); // display response. } } }; } dataUrl = dataUrl.substr(dataUrl.indexOf("base64,",0)+7);
var cr = "\r\n";
var boundary = "--"+ boundaryString;
var body = boundary + cr;
body+="Content-Disposition: form-data; name=\"key\""+cr+cr;
body+="key"+cr;
body+=boundary+cr;
body+="Content-Disposition: form-data; name=\"fileupload\"; filename=\"gprFoto.jpeg\""+cr;
body+="Content-Type: image/jpeg"+cr;
body+="Content-Transfer-Encoding: base64"+cr+cr
body+=dataUrl+ cr;
body+=boundary+"--"+cr;
xhr.send(body);
Comment #1
Posted on Dec 7, 2012 by Quick CamelI am a android developer .I want image upload by the ImageshackApi for android apps.Is it possible.If it possible please send to me the sample code
Status: New
Labels:
Type-Defect
Priority-Medium