title: How to save an uploaded file on localhost?
body: <p>I have been using to upload an image file from HTML5/JS and using PHP script to save it in localhost(/var/www/) but i cant save it. the function move_uploaded_file always returns false while there is exists an object in _FILES object. I am a newbie in php:</p>
  
  <pre><code>  $target = "upload/";
    if(!empty($_FILES))
    {
       if(move_uploaded_file($_FILES['image_file']['tmp_name'], $target)) 
       {
       echo "The file ". basename( $_FILES['image_file']['name']). " has been uploaded...";
       } 
       else {
       echo "Sorry, there was a problem uploading your file. {$error}";
       }
    }
    else
    {
      echo "_files is empty";
    }
  </code></pre>