我正在尝试将图片上传到具有上传日期的文件夹,但是当我尝试执行代码时,它会显示此错误:
Warning: mkdir(): No such file or directory in
C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\code\members\action\addc_do.php on line 63
Warning: move_uploaded_file(upload/2015-06-21/c49a7b2f6945d903988b17e91d7e6c91.png):
failed to open stream: No such file or directory in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\code\members\action\addc_do.php on line 70
Warning: move_uploaded_file(): Unable to move 'C:\Windows\Temp\phpD6C1.tmp' to 'upload/2015-06-21/c49a7b2f6945d903988b17e91d7e6c91.png' in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\code\members\action\addc_do.php on line 70 error
我认为这是关于文件夹权限的,如果是的话,我如何在Windows中为文件夹添加777权限。
答案 0 :(得分:1)
mkdir()每次执行只创建一个子目录。你正在尝试同时创建两个。您可以像这样进行两次调用:
mkdir("upload");
mkdir("upload/2015-06-21");
或使用递归选项,如下所示:
mkdir("upload/2015-06-21", 0777, true);