FINALLY!! was able to upload image from android to server via
asp.net
web service. hope this help someone
navigator.camera.getPicture(uploadPhoto,
function(message) { alert('get
picture failed'); },
{ quality: 50,
destinationType:
navigator.camera.DestinationType.FILE_URI,
sourceType:
navigator.camera.PictureSourceType.PHOTOLIBRARY }
);
function uploadPhoto(imageURI) {
var options = new FileUploadOptions();
options.fileKey="recFile";
var imagefilename = Number(new Date())+".jpg";
options.fileName=imagefilename;
options.mimeType="image/jpeg";
var params = new Object();
params.value1 = "test";
params.value2 = "param";
options.params = params;
var ft = new FileTransfer();
ft.upload(imageURI, "
http://site.com/WebSite1/
FileUpload.asmx/SaveImage", win, fail, options);
}
function win(r) {
//console.log("Code = " + r.responseCode);
//console.log("Response = " + r.response);
alert("Sent = " + r.bytesSent);
}
function fail(error) {
alert("An error has occurred: Code = " + error.code);
}
my
asp.net web service code:
[WebMethod]
public string SaveImage()
{
HttpPostedFile file =
HttpContext.Current.Request.Files["recFile"];
string targetFilePath = "c:\\" + file.FileName;
file.SaveAs(targetFilePath);
return file.FileName.ToString();