PHP Basic Grammar learning almost, and now began to learn PHP file upload function implemented. The function is used in the Move_uploaded_file method, run The Times wrong: failed to open stream.
After checking the data, this paper summarizes several possible causes and solutions of the error.
Reason one: The directory you moved to is not spelled correctly
My directory is as follows:
This is the example in the fourth edition of PHP and MySQL Web development, and my PHP version is 7.0.2, which executes the times failed to open stream error. There are two workarounds for this error: The first is the absolute path, such as "d:/uploads/", and the second: when using a relative path, use "./uploads/" to indicate that the file is moved to the uploads directory under the current default directory, or use ". /uploads/"indicates that the file is moved to the uploads directory under the parent directory of the current directory.
Reason two: The directory moved to does not exist
The failed to open stream error will also be reported if the directory that you moved to does not exist. Creating a corresponding directory solves the problem.
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes the Move_uploaded_file failed to open stream error handling, including aspects of the content, I hope to be interested in PHP tutorial friends helpful.