Solution to PHP Upload not finding temporary folder

  • 2021-09-12 00:45:40
  • OfStack

Recently, I encountered such trouble. I couldn't find the temporary folder and returned an error code of 6

Error cause:

1. The configuration file does not have a temporary folder set

2. Temporary folders do not have permissions or parent folders do not have permissions

Handling method:

Locate the PHP configuration file PHP. ini and find the following code

;upload_tmp_dir =

Replace with the following:


upload_tmp_dir = "C:/Windows/Temp"  // The following folder path is set according to your system 

If the permissions are not enough, you can add corresponding permissions to the files according to the impassable operating system

Other knowledge:

$_FILES['file']['error']

Its value is 0, no errors occurred, and the file was uploaded successfully.

With a value of 1, the uploaded file exceeds the limit of the upload_max_filesize option in PHP. ini.

With a value of 2, the uploaded file size exceeds the value specified by the MAX_FILE_SIZE option in the HTML form.

Its value is 3, and only part of the file is uploaded.

Its value is 4, and no files are uploaded.

With a value of 6, the temporary folder could not be found. PHP 4.3. 10 and PHP 5.0. 3 were introduced.

Its value is 7, and the file write failed. PHP 5.1. 0 was introduced.

If you read the error, it should be that the temporary folder does not have write permission or does not exist

Summarize


Related articles: