简体   繁体   中英

How do I make move_uploaded_files work in PHP?

What I have right now for file upload is:

move_uploaded_file($filetemp, "files/$filename");

With filetemp referring to $_FILES['fileupload']['tmp_name'], filename referring to $_FILES['fileupload']['name'], and files referring to a folder of that name inside the folder where the PHP file is.

However, this does not move the file to the files folder. How do I make it so that the function moves the file there?

Thanks!

Nerd With a Vengeance

There could be any number of reasons why this might not be working.

The first thing to check is permissions - make sure the webserver has write permissions to the directory you're trying to write to.
Also, turn your error reporting up - see what warnings are being generated on failure (assuming that you're return value is indeed false).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM