douxi3432 2015-04-07 14:44
浏览 214
已采纳

move_uploaded_file()无法移动文件导致我的权限? [关闭]

I have a problem with PHP.

Basically, I have a script that take a file from a form, and I want to upload it on the server.

What i do is :

function uploadXLS($file){
$target_dir = "../uploads/";
$target_file = $target_dir . $file["name"];

if(checkFile($file) == False) return null;
echo "checked";

$result = move_uploaded_file($file["tmp_name"], $target_file);
echo "move";
if($result != 1)return null;
echo "done<br>"; 
}

This works perfectly in localhost with Wamp, but on the server that I use (which is not mine) I the move_uploaded_file don't work.

I don't think there is a password or something like that, it should be an "open" server. What can I do to try to fix this problem?

  • 写回答

1条回答 默认 最新

  • dsklfsdlkf1232 2015-04-07 14:46
    关注

    It's the user permission on linux, you can change the permission for the file by execution this command:

    chmod 755 your_file.jpg
    

    Or for the hole folder:

    chmod 755 -R folder/
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于大棚监测的pcb板设计
  • ¥20 sim800c模块 at指令及平台
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计