title: PHP upload not working
body: <p>I've been trying to get my PHP upload script working, the HTML side seems to work but the PHP keeps returning a failed result.  I am using iPage hosting.  Here is my script:</p>
  
  <pre><code>&lt;?php
  if(isset($_FILES['userfile'])){
  $uploaddir = '/var/www/uploads/';
  $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
  
  echo "&lt;p&gt;";
  
  if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
    echo "File is valid, and was successfully uploaded.\n";
  } else {
     echo "Upload failed";
  }
  
  echo "&lt;/p&gt;";
  echo '&lt;pre&gt;';
  echo 'Here is some more debugging info:';
  print_r($_FILES);
  print "&lt;/pre&gt;";
  } else {
  ?&gt;
  &lt;form enctype="multipart/form-data" action="" method="POST"&gt;
      &lt;input type="hidden" name="MAX_FILE_SIZE" value="512000" /&gt;
      Send this file: &lt;input name="userfile" type="file" /&gt;
      &lt;input type="submit" value="Send File" /&gt;
  &lt;/form&gt;
  &lt;?php
  }
  ?&gt;
  </code></pre>