title: want to upload a pic to the server using phonegap in android
body: <p>I am doing project in android phonegap and I want to upload pic to the server.</p>
  
  <p>But I am not getting idea, where should I put this code. </p>
  
  <p>I can't show any buttons to upload photos, please help.</p>
  
  <p>I am new in this. I refereed this code from phonegap documentation.</p>
  
  <p>I am trying this for hours, but can't get the better solution. </p>
  
  <p>It's my first android phonegap project.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>   &lt;head&gt;
     &lt;script type="text/javascript" charset="utf-8" src="cordova-2.4.0.js"&gt;&lt;/script&gt;
     &lt;script type="text/javascript" charset="utf-8"&gt;        
      document.addEventListener("deviceready", onDeviceReady, false);
  
      function onDeviceReady() {           
          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="file";
          options.fileName=imageURI.substr(imageURI.lastIndexOf('/')+1);
          options.mimeType="image/jpeg";
  
          var params = {};
          params.value1 = "test";
          params.value2 = "param";
  
          options.params = params;
  
          var ft = new FileTransfer();
          ft.upload(imageURI, encodeURI("http://some.server.com/upload.php"), win, fail, options);
      }
  
      function win(r) {
          console.log("Code = " + r.responseCode);
          console.log("Response = " + r.response);
          console.log("Sent = " + r.bytesSent);
      }
  
      function fail(error) {
          alert("An error has occurred: Code = " + error.code);
          console.log("upload error source " + error.source);
          console.log("upload error target " + error.target);
      }
  
      &lt;/script&gt;
   &lt;/head&gt;
   &lt;body&gt;
      &lt;h1&gt;Example&lt;/h1&gt;
      &lt;p&gt;Upload File&lt;/p&gt;
   &lt;/body&gt;
  </code></pre>