Tag Archives: move_uploaded_file

An idea to solve Warning move_uploaded_file, failed to open stream in the process of php uploading files

Warning Move_uploaded_file failed to open stream
Problem description:
Do not know to have people with PHP upload files and encounter this kind of situation, when faced with this situation, I checked the Internet all kinds of information folder permissions are said not to, need to chmod 757, but not this command in the Windows, also have said need to change tmp_dir, but the answers are not change warning, so I carefully observed the tip mistakes, find a solution.

Solutions:
No such file or directory in… I can’t find the file or folder, so I go back to the directory where the project is located. There is no directory created after the move, so there is an error. So the way to fix it is to create a folder.
The core code is as follows:

move_uploaded_file($_FILES["file"]["tmp_name"], "./uploads/" . $_FILES["file"]["name"]);