I want to upload an image to a server for my phone gallery.
I did with an iOS device, this works well. But there are problems in the Android device.
I take an image from the device gallery and publish on the server. It loads successfully. after that I see on the server.
the image of which is uploaded by the Android device is in .txt format. (iOS work well).
How do I remove the problem. Please help me show my coding structure.
Ti.API.info("success! event: " + JSON.stringify(event));
var image = event.media;
var abc = event.media.imageAsResized(400 , 400);
Ti.API.info(abc.height +" x "+ abc.width);
alert(abc.height +" x "+ abc.width);
var xhr = Titanium.Network.createHTTPClient();
xhr.onerror = function(e)
{
Ti.API.info('IN ERROR ' + e.error);
alert("error");
};
xhr.onload = function()
{
Ti.API.info('IN ONLOAD ' + this.status + ' readyState ' + xhr.responseText);
alert("IN ONLOAD " + this.status + " readyState " + this.readyState + "re " +xhr.responseText);
};
xhr.open('POST','http://reviewprototypes.com/kishan/filetest.php');
xhr.send({file:abc});
},
cancel : function() {
alert("Cancel Library ");
},
error : function(error) {
alert("Error Massage "+error);
},
allowImageEditing:true,
});
Any suggestion is welcome. Thanks at Advance.
source
share