12-05-2012 05:23 PM
I have sample code for doing this in C#, Windows Phone 7, Silverlight, and I'm trying to find how to do the equivalent in C++ QT (I am working in the Blackberry 10 Beta 3 SDK). Can I use QNetworkAccessManager? or is there something better for this? I would appreciated some help on how to do this and some sample code if you can. Here is the sample C# code:
var request = newRestRequest(url,Method.POST);
request.AddParamater("example","example");
request.AddParamater("example2","example2");
request.AddFile("file", fileData, filename,"image/pjpeg");
RestSharp.RestClient restClient = new RestClient();
restClient.ExecuteAsync(request,(response)=> {
if(response.StatusCode==HttpStatusCode.OK){
//upload successful}else{//error occured durring upload}
}else{
//error occured durring upload
}
});
12-05-2012 06:03 PM
you should use the QNetworkAccessManager
12-06-2012 11:48 AM
You should also be able to do this from your QML in JavaScript with XMLHttpRequest. I've verified that this works for simple POST data but haven't tried uploading a file.