title: Titanium Appcelerator uploading images to webserver
body: <p>I am having a lot of issues trying to upload files to the server in Titanium appcelerator.  All seems to work fine, but in the server it shows that an error has occurred.  Here's my Titanium code:</p>
  
  <pre><code> var win = Ti.UI.createWindow({
  
  backgroundColor : "#FFF"
  });
  
  
   var ind = Titanium.UI.createProgressBar({
  width : 200,
  height : 50,
  min : 0,
  max : 1,
  value : 0,
  style : Titanium.UI.iPhone.ProgressBarStyle.PLAIN,
  top : 10,
  message : 'Uploading Image',
  font : {
      fontSize : 12,
      fontWeight : 'bold'
  },
  color : '#888'
    });
  
    win.add(ind);
    ind.show();
  
     win.open();
  
        Titanium.Media.openPhotoGallery({
  
  success : function(event) {
      alert("success! event: " + JSON.stringify(event));
      var image = event.media;
  
      var xhr = Titanium.Network.createHTTPClient();
  
      xhr.onerror = function(e) {
          Ti.API.info('IN ERROR ' + e.error);
      };
      xhr.onload = function() {
          Ti.API.info('IN ONLOAD ' + this.status + ' readyState ' + this.readyState);
      };
      xhr.onsendstream = function(e) {
          ind.value = e.progress;
          //Ti.API.info('ONSENDSTREAM - PROGRESS: ' + e.progress + ' ' + this.status + ' ' + this.readyState);
      };
      // open the client
      xhr.open('POST', 'http://mypathtotheserver/myphpuploaderfile.php');
      xhr.setRequestHeader("Connection", "close");
      // send the data
      xhr.send({
          media : image
      });
  
  },
  cancel : function() {
  
  },
  error : function(error) {
  },
  allowImageEditing : true
  </code></pre>
  
  <p>});</p>
  
  <p>and the php code in the server:</p>
  
  <pre><code>  $target_path = "uploads/";
  
   $target_path = $target_path .  $_FILES['media']['name']; 
  
   if(move_uploaded_file($_FILES['media']['tmp_name'],$target_path)) {
      echo "The file ".  basename( $_FILES['media']['name']). 
      " has been uploaded";
    } 
    else
   {
    echo "There was an error uploading the file, please try again!";
   }
  </code></pre>
  
  <p>What am I doing wrong?  Any help is highly appreciated.</p>
  
  <p>Thank you in advance!</p>