title: Phonegap file upload to the asmx web service
body: <p>I'm trying to upload image file to the asmx web service from Android and ios device but i'm getting error which list of below:</p>
  
  <p>for Android:
  FileNotFoundException on the server
  Error on FileTransfer.upload
  Error on FileTransfer.execute
  IOException: Received error from server.
  "http_status":500, "code":1</p>
  
  <p>for iOS:
  FileNotFoundException on the server
  Error on FileTransfer.upload
  Error on FileTransfer.execute
  IOException: Received error from server.
  "http_status":500, "code":3</p>
  
  <p>I'm using Icenium for development and service_url parameter of ft.upload() method is working i can call web service on browser but when i try to use in my project i got same error.</p>
  
  <p>IIS logs below:</p>
  
  <p>Software: Microsoft Internet Information Services 7.5</p>
  
  <p>Version: 1.0</p>
  
  <p>Date: 2013-02-22 11:00:07</p>
  
  <p>Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User- Agent) sc-status sc-substatus sc-win32-status time-taken</p>
  
  <pre><code>2013-02-22 11:00:07 192.168.1.103 POST /ExpenseService.asmx/UploadFile - 40201 - 78.189.173.183 Camera%20Sample%20Official/1.0+CFNetwork/609+Darwin/13.0.0 500 0 0 287 2013-02-22 11:01:28 192.168.1.103 POST /ExpenseService.asmx/UploadFile - 40201 - 78.189.173.183 Camera%20Sample%20Official/1.0+CFNetwork/609+Darwin/13.0.0 500 0 0 144
  </code></pre>
  
  <p>my cordova version 2.2.0. Any ideas what i did wrong?</p>
  
  <p>ASMX Service:</p>
  
  <pre><code>#region FileUpload
      [WebMethod]
      //[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
      public string UploadFile()
      {
          try
          {
              File.WriteAllText(@"d:\test.txt", "hede");
              HttpPostedFile file = HttpContext.Current.Request.Files[0];
              if (file == null)
                  return null;
              string targetFilePath = @"d:\" + file.FileName;
              file.SaveAs(targetFilePath);
              return file.FileName.ToString();
          }
          catch (Exception ex)
          {
              File.WriteAllText(@"d:\uploader.txt", ex.Message.ToString());
              return null;
          }
  
      }
      #endregion
  </code></pre>
  
  <p>Client Side:</p>
  
  <pre><code>var options = new FileUploadOptions(); 
  options.chunkedMode  = false;
  options.fileKey = "ficheFile";
  console.log('imageFileName: ' + imageFileName);    
  options.fileName = imageFileName; 
  options.mimeType="image/jpeg";
  console.log('imageSrc: ' + imageSrc);
  
  var ft = new FileTransfer(); 
  ft.upload(imageSrc, encodeURI("http://mydomain:40201/ExpenseService.asmx/UploadFile"), win, fail, options); 
  </code></pre>
  
  <p>Here is my adb logcat:</p>
  
  <pre><code>E/FileTransfer(11472): {"target":"http:\/\/mydomain:40201\/ExpenseService.asmx\/SaveFile","source":"file:\/\/\/mnt
  \/sdcard\/Android\/data\/com.telerik.Camera_Sample_Official\/cache\/1361950930301.jpg","http_status":500,"code":1}
  E/FileTransfer(11472): java.io.FileNotFoundException: http://78.189.173.183:40201/ExpenseService.asmx/SaveFile
  E/FileTransfer(11472):  at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(H
  ttpURLConnectionImpl.java:521)
  E/FileTransfer(11472):  at org.apache.cordova.FileTransfer.getInputStream(FileTransfer.java:480)
  E/FileTransfer(11472):  at org.apache.cordova.FileTransfer.access$400(FileTransfer.java:62)
  E/FileTransfer(11472):  at org.apache.cordova.FileTransfer$1.run(FileTransfer.java:402)
  E/FileTransfer(11472):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
  E/FileTransfer(11472):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
  E/FileTransfer(11472):  at java.lang.Thread.run(Thread.java:1019)
  D/CordovaLog(11472): Error Code: 1
  D/CordovaLog(11472): : Line 1153648589 : Error Code: 1
  I/Web Console(11472): Error Code: 1 at :1153648589
  </code></pre>
  
  <p>Kind Regards.</p>