In the "PHP 5.3 Primer Classic" 9.6.3 Trial (P235), gave an example of uploading files, where the file format is a JPEG image (Image/jpeg). If the Upload_tmp_dir parameter in PHP.ini was not previously configured, an upload failure message will appear. See the code snippet below
if (isset($_files$_files["Photo"] ["error"] = = UPLOAD_ERR_OK)
If the condition in the judgment statement is true, continue. At this point, the $_files["photo" ["error"] value is 6,UPLOAD_ERR_OK value of 0 (indicates successful upload).
The meanings of the different values of $_files["Photo" ["error"] are listed below:
The temporary folder could not be found, which is generally configured for Upload_tim_dir in Php.int, or its value is misconfigured.
Online example generally recommended Upload_tim_dir = "C:\Windows\Temp", in fact, because of security/permissions and other reasons, will still error (6).
Therefore, the author modifies its path to other, such as Upload_tim_dir = "C:\temp", at which time the program can run normally. Some bloggers mentioned the need to add "write" permissions to the Users group/user of the "C:\temp" folder. While the author tests that it is possible to not modify, it may be related to the machine/OS environment.
Tips:upload_tim_dir = "C:\Windows\Temp" in the path string to replace "\" with "/" or the combination of the two has no effect. (PHP 7.1.6)
Configuring Upload_tmp_dir in PHP.ini when uploading files to PHP