Bootstrap FreeKB - PHP - Resolve move_uploaded_file not uploading file
PHP - Resolve move_uploaded_file not uploading file

Updated:   |  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

  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




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


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