简体   繁体   English

如何使move_uploaded_files在PHP中工作?

[英]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"); 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. filetemp引用$ _FILES ['fileupload'] ['tmp_name'],文件引用$ _FILES ['fileupload'] ['name'],文件引用PHP文件所在文件夹中该名称的文件夹。

However, this does not move the file to the files folder. 但是,这不会将文件移动到files文件夹。 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. 要检查的第一件事是权限 - 确保Web服务器对您尝试写入的目录具有写入权限。
Also, turn your error reporting up - see what warnings are being generated on failure (assuming that you're return value is indeed false). 此外,转换错误报告 - 查看失败时生成的警告(假设您的返回值确实为假)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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