PHP - Resolve move_uploaded_file not uploading file

by
Jeremy Canfield |
Updated: March 12 2020
| PHP articles
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
- Give IUSR the write permission to the directory the files are being uploaded to server-side. The directory is D:\php\upload_tmp\.
- Give IUSR the write permission to the final upload directory. The directory is D:\ISCCSites\share
Did you find this article helpful?
If so, consider buying me a coffee over at