title: PHP rename() file_exists()
body: <p>How can I use PHP to move a file?</p>
  
  <p>Code:</p>
  
  <pre><code>if( file_exists($imageLocation) )
    echo "file exists on server";
  
  rename($imageLocation, $imageNewLocation);
  </code></pre>
  
  <p>Output:</p>
  
  <blockquote>
    <p>file exists on server
    Warning: rename(/home/images/file1.jpg,/home/newloc/renamed.jpg) [function.rename]: No such file or directory in /home/apps/images/add.php on line 81</p>
  </blockquote>
  
  <p>I don't know where to go from here.</p>