title: PHP move_uploaded_file/copy issue
body: <p>Interesting issue I seem to have come across.  I have a form that uploads an image and stores the value in a database table.  The form uploads the image file OK and makes it available for processing.  The issue is as follows;  using move_uploaded_file to the specified directory does not work, however using <code>copy()</code> to this directory does.</p>
  
  <p>The code currently is as follows:</p>
  
  <pre><code>$file = $_FILES['doc_path'];
  
    $ext = array_pop(explode('.', $file['name']));
    $filename = uniqid() . '.' . $ext;
  
    if ($file['error'] == UPLOAD_ERR_NO_FILE &amp;&amp; ! strlen($this-&gt;filename)) {
     throw new Exception('Please select a file to upload');
    } elseif ($file['error'] == UPLOAD_ERR_NO_FILE) {
     return true; // already have a file
    } elseif ($file['error']) {
     throw new Exception('File upload error');
    } elseif (! $file['size']) {
     throw new Exception('File is of zero length');
    } else {
  
     $path = 'uploads/' . $filename;
  
  
     if (! move_uploaded_file($file['tmp_name'], $path)) {
      throw new Exception('Could not upload file');
     }
  
     return $filename;
    }
  </code></pre>
  
  <p>I have checked that the target directory exists, and the directory is writable.  No error is produced using move_uploaded_file() just the "Could not upload file" exception is caught.</p>
  
  <p>Would have thought if this was a permissions issue then substituting <code>move_uploaded_file</code> for <code>copy</code> wouldn't work?</p>