title: Image upload using FileTransfer.Upload to ASP.NET REST API
body: <p>I am currently trying to implement <code>Android App</code> using <code>Phonegap ionic framework</code>. My requirement is to upload an image from gallery to remote server. To achieve this I implemented <code>ASP.NET</code> <code>REST API</code> to upload image to server. (Let assume my URL to upload: <code>http://XXXX.net/api/Upload</code>). Inside my REST API I implemented <code>UploadController:WebController</code>. I has a Post() method which looks like below. </p>
  
  <p>Server Code:</p>
  
  <pre><code>public string Post()
  {
      HttpPostedFile MyFile = HttpContext.Current.Request.Files["recFile"];
      if (MyFile == null)
          return null;
      return Utils.UploadToServer(file);
  }
  </code></pre>
  
  <p><strong>My Android code looks like below:</strong></p>
  
  <pre><code>$scope.UploadPictureEx = function()
  {
      var options = new FileUploadOptions();
      options.fileKey="recFile";  
      options.fileName=$scope.emplyeedata.ImageURI.substr($scope.emplyeedata.ImageURI.lastIndexOf('/')+1);
      options.mimeType="image/jpeg";
      var params = new Object();
      params.value1 = "test";
      params.value2 = "param";
      options.params = params;
      options.chunkedMode = false;
      options.httpMethod = "POST";
      options.headers = {
              Connection: "close"
      };
      var ft = new FileTransfer();
      ft.upload($scope.emplyeedata.ImageURI, "http://XXXX.net/api/Upload/", win, fail, options);
  }
  </code></pre>
  
  <p>Thats it. When I execute I always getting error saying <code>Error code = 3</code>. Can any one please let me know how to get this done? 
  Is my approach of implementing Web API is correct? Am I doing some thing wrong? 
  Thanks!!</p>