title: Phonegap: Photo not uploading
body: <p>I'm trying to create a very basic photo upload feature. I've followed a lot of tutorials and examples online but I'm having some issues in actually getting it to work.</p>
  
  <p>Currently I receive the following errors:</p>
  
  <pre><code>2012-03-26 17:37:02.107 Upload[84710:13403] fileData length: 72154
  2012-03-26 17:37:02.119 Upload[84710:13403] File Transfer Error: unsupported URL
  2012-03-26 17:37:02.121 Upload[84710:13403] [INFO] Error in error callback: org.apache.cordova.filetransfer1 = ReferenceError: Left side of assignment is not a reference.
  </code></pre>
  
  <p>This is my Phonegap HTML file:</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;File Transfer Example&lt;/title&gt;
      &lt;script type="text/javascript" charset="utf-8" src="cordova-1.5.0.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" charset="utf-8"&gt;
  
          // Wait for PhoneGap to load
          document.addEventListener("deviceready", onDeviceReady, false);
  
          // PhoneGap is ready
          function onDeviceReady() {
    // Do cool things here...
          }
  
          function getImage() {
              // Retrieve image file location from specified source
              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 = new Object();
              params.value1 = "test";
              params.value2 = "param";
  
              options.params = params;
              options.chunkedMode = false;
  
              var ft = new FileTransfer();
              ft.upload(imageURI, "hosting.domain.co.uk/ios/upload.php", win, fail, options);
          }
  
          function win(r) {
              console.log("Code = " + r.responseCode);
              console.log("Response = " + r.response);
              console.log("Sent = " + r.bytesSent);
              alert(r.response);
          }
  
          function fail(error) {
              alert("An error has occurred: Code = " = error.code);
          }
  
          &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;button onclick="getImage();"&gt;Upload a Photo&lt;/button&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And this is my upload.php file:</p>
  
  <pre><code>&lt;?php
  print_r($_FILES);
  $new_image_name = "namethisimage.jpg";
  move_uploaded_file($_FILES["file"]["tmp_name"], "/var/www/vhosts/domain.co.uk/subdomains/hosting/httpdocs/ios/uploads".$new_image_name);
  ?&gt;
  </code></pre>
  
  <p>Is there anything obvious that I'm doing wrong?</p>
  
  <p>Thanks a lot</p>
  
  <p>Jon</p>