title: Ubuntu Server won't upload files with PHP 'move_uploaded_file'
body: <p>I'm trying to upload files using my Ubuntu Virtual Server.</p>
  
  <p>The PHP function moving the uploaded files returns the following error:</p>
  
  <blockquote>
    <p>"Warning: move_uploaded_file(files/Site Logo.png): failed to open stream: Permission denied in /var/www/test.php on line 5 Warning: move_uploaded_file(): Unable to move '/tmp/phpZB7Mxi' to 'files/Site Logo.png' in /var/www/test.php on line 5"</p>
  </blockquote>
  
  <p>The directory has permissions <code>0777</code> which I set through the SSH and it still doesn't upload. PHP.ini is configured to <code>upload ON</code> and stuff but no luck. I'd guess its permissions problems but I have set it to pretty much <code>RWX</code> for every user?</p>
  
  <p>My code originally was too complex for a video system so I tried a basic code like below:</p>
  
  <pre><code>$file = $_FILES['video']['name'];
  echo $file;
  move_uploaded_file($_FILES['video']['tmp_name'],"files/".$file);
  echo "Done";
  </code></pre>
  
  <p>This wouldn't work either. So I am guessing it's how the server is configured?</p>