PHP move_uploaded_file not uploading file

Home > Search
  by

If you are unable to move a file using PHP's move_uploaded_file, add the following code to the PHP file which uploads the file.

ini_set('display_errors',1);
error_reporting(E_ALL);

echo '<pre>';
print_r($_FILES);
echo '</pre>';

Following are common errors, and the solutions for the errors.


Warning: move_uploaded_file(uploads/1.png): failed to open stream: Permission denied in D:\path\to\image_upload.php on line 28

Warning: move_uploaded_file(): Unable to move 'D:\php\upload_tmp\phpEE37.tmp' to 'uploads/1.png' in D:\path\to\pbsmart\image_upload.php on line 28

  1. Give IUSR the write permission to the directory the files are being uploaded to server-side. The directory is D:\php\upload_tmp\.
  2. Give IUSR the write permission to the final upload directory. The directory is D:\ISCCSites\share


Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments