PHP upload file does not generate files and directories
I wrote a simple file upload page with PHP, showing that the upload was successful, but
(1), the corresponding directory but not uploaded files "tmp directory without files, and did not generate upload directories and files."
(2), move_uploaded_file parameter order, the code in the middle of the wrong line, the next line is correct, and the opposite of the textbook.
Ask the great God for doubts.
Upload.html
upload.php
0) {echo "error:". $_files["File" ["Error"]. "
";} Else{echo "Upload:". $_files["File" ["Name"]. "
"; echo" Type: ". $_files["File" ["Type"]. "
"; echo" Size: ". ($_files["File" ["Size"]/1024). " Kb
"; echo" Stored in: ". $_files[" File "[" Tmp_name "]."
if (file_exists ("upload/". $_files["File" ["name"]) {echo $_files["file"] ["name"]. "already exists.";} Else{//move_uploaded_file ($_files["file"] ["Tmp_name"], "upload/". $_files["File" ["name"]);//Error Move_uploaded_ File ("upload/". $_files["File" ["Name"],$_files["file"] ["tmp_name"]); echo "
Storeed in: "." upload/". $_files[" File "[" Name "];}}? >
Operation Result:
Upload:d.txt
Type:text/plain
size:2.439453125kb
Stored in:e:\wamp\tmp\php4a7.tmp
Storeed In:upload/d.txt
Reply to discussion (solution)
Come and save Me ~~~~~~~~~~~~~~~~~~~~
What's wrong with the last sentence?
The Move_uploaded_file will return a value. See if this method performs successfully.
Path exists?
Write permission?
What's wrong with the last sentence?
Warning:move_uploaded_file (Upload/d.txt) [Function.move-uploaded-file]: failed to open stream:no such file or directory
Warning:move_uploaded_file () [Function.move-uploaded-file]: Unable to move ' E:\wamp\tmp\php4D5.tmp ' to ' upload/d.txt '
The Move_uploaded_file will return a value. See if this method performs successfully.
Path exists?
Write permission?
I tried, and the return value was false.
There is no upload directory under the current directory? It should be created first.
There is no upload directory under the current directory? It should be created first.
Thank you, I have built the upload directory in the current directory (previously built the wrong, built the uploaded), and run the previous sentence, the results run correctly.
The Move_uploaded_file will return a value. See if this method performs successfully.
Path exists?
Write permission?
After the catalog has been built, it runs correctly, thanks.
There is no upload directory under the current directory? It should be created first.
However, the appropriate temporary files are still not generated under the E:\wamp\tmp\ directory.
There is no upload directory under the current directory? It should be created first.
However, the appropriate temporary files are still not generated under the E:\wamp\tmp\ directory.
To see the configuration. See which directory is configured. Phpinfo