title: uploading files with jquery $.ajax and php
body: <p>I desire to upload files asynchronous when the user select a file in a input file, with $.ajax. But the php that recive the call return index undefined.
  The jquery code is the next:</p>
  
  <pre><code>$("#urlimatge").change(function(){
              var filename = $("#urlimatge").val();
              $.ajax({ 
                  type: "POST",
                  url: "utils/uploadtempimg.php",
                  enctype: 'multipart/form-data',
                  data: {'urlimatge' : filename },
                  success: function(response){
                       alert(response);
                  }
              }); 
  
          });
  </code></pre>
  
  <p>and the php that recibe the call:</p>
  
  <pre><code>$image =  new gestorimatges();
  $target_path = $image-&gt;uploadTemp($_FILES['urlimatge']['name'],$_FILES['urlimatge']['tmp_name']);
  </code></pre>
  
  <p>Thanks</p>