问题描述
Warning: move_uploaded_file(C:\wamp\www/uploads/a.mp3): failed to open stream: No such file or directory in C:\wamp\www\display\uploadfile.php on line 206
Warning: move_uploaded_file(): Unable to move 'C:\wamp\tmp\php75FD.tmp' to 'C:\wamp\www/uploads/a.mp3' in C:\wamp\www\display\uploadfile.php on line 206
var_dump:
array (size=1)
'file' =>
array (size=5)
'name' => string 'a.mp3' (length=5)
'type' => string 'audio/mp3' (length=9)
'tmp_name' => string 'C:\wamp\tmp\php75FD.tmp' (length=23)
'error' => int 0
'size' => int 4030592
tmp和上载目录的权限设置为所有人>完全权限
tmp and upload directories have permissions set to everyone > Full Permissions
PHP的上传文件大小设置正确
PHP has upload filesize set correctly
我不知道为什么文件无法上传...
I have no idea why the file wont upload...
代码: http://pastebin.com/kFG2v2PJ
推荐答案
问题:C:\wamp\www/uploads/
.
将斜杠更改为反斜杠,并确保目录C:\wamp\www\uploads\
存在.您可以使用 DIRECTORY_SEPARATOR
常量来使代码在多个系统上工作.
Change your slashes to backslashes and make sure the directory C:\wamp\www\uploads\
exists. You could use the DIRECTORY_SEPARATOR
constant to make your code work on multiple systems.
此外,在没有看到您的代码的情况下,您需要确保将正确的参数放入 move_uploaded_file()
Also, without seeing your code, you need to make sure you're putting the correct paramaters in move_uploaded_file()
在代码后
更改
$target_path = APP_PATH."/uploads/";
到
$target_path = APP_PATH . DIRECTORY_SEPARATOR . "uploads" . DIRECTORY_SEPARATOR;
这篇关于Windows上带有wamp的move_uploaded_file()错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!