Can't upload photo via Ushahidi Api


#1

Hi,

I’m using Titanium Studio for making a smartphone application. It offers a module to create HTTP Post requests and coding is done in JavaScript.

With that, I’m able to add new reports to the Ushahidi web platform, but can’t add new reports when I add a photo to the POST request.
I get error code 003, message "The Upload Photos field does not appear to contain a valid file"

Here’s the code:

var rclient = Titanium.Network.createHTTPClient();							
rclient.onload = function()
{
	 alert("responseText: " + this.responseText);
};
rclient.onerror = function(e)
{
	alert('Transmission error: ' + e.error);
};

rclient.open("POST","http://myushahidiURL.com/api");
var params = {
	"task":"report",
	"incident_title": title.value,
	incident_description: descr.value,
	incident_date: dateform,
	incident_hour:hour,
	incident_minute:min,
	incident_ampm:amPM,
	incident_category:'1',
	latitude:lat,
	longitude:longi,
	location_name:loc.value,
	incident_photo:theimg
};
rclient.send(params);

For incident_photo:theimg , i’ve tried putting raw binary image data in theimg and also base64 encoded data in theimage, I still get the error:
“The Upload Photos field does not appear to contain a valid file”

Any help? :confused: