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

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?

图片转代码服务由CSDN问答提供 功能建议

我遇到PHP问题。

基本上我有一个脚本 从表单中获取文件,我想将其上传到服务器上。

我的工作是:

  function uploadXLS  ($ file){
 $ target_dir =“../uploads/";
$target_file = $ target_dir。  $ file [“name”]; 
 
if(checkFile($ file)== False)返回null; 
echo“checked”; 
 
 $ result = move_uploaded_file($ file [“tmp_name”],$ target_file  ); 
echo“move”; 
if($ result!= 1)返回null; 
echo“done&lt; br&gt;”;  
 <
   
 
 

这在带有Wamp的localhost中完美有效,但在我使用的服务器上(不是我的)我是 move_uploaded_file 不工作。

我认为没有密码或类似的东西,它应该是一个“开放”的服务器。 我该怎么做才能解决这个问题?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

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/
    
    点赞 打赏 评论

相关推荐 更多相似问题