首页 文章

消息:move_uploaded_file():无法打开流:codeigniter中的权限被拒绝

提问于
浏览
0

我的项目使用xampp在localhost中运行良好,但在远程服务器中,当我试图上传或更新图像时,我遇到了错误,..

警告:消息:move_uploaded_file(images / 1458100947_2.jpg):无法打开流:权限被拒绝

这里是错误所在的代码 .

$imagename = $this->person->view($this->input->post('id'))->image;
     if(file_exists("images/$imagename")) unlink("images/".$imagename);
     $fileName = time(). '_' .$_FILES["image"]["name"];
        move_uploaded_file($_FILES["image"]["tmp_name"],$output_dir.$fileName); //this line
$targetPath = 'images/' . $fileName;
    $config_resize['image_library'] = 'gd2';
     $config_resize['create_thumb'] = FALSE;
     $config_resize['maintain_ratio'] = TRUE;
  //   $config_resize['master_dim'] = 'height';
     $config_resize['quality'] = "80%";
     $config_resize['source_image'] = $targetPath;
     $config_resize['height'] = 600;
     $config_resize['width'] = 1024;
  //   $config_resize['thumb_marker'] = '';
     $config_resize['new_image'] = 'images/' . $fileName;
     $this->image_lib->initialize($config_resize);
     $this->image_lib->resize();

     $uploaded = TRUE;

我试图谷歌如何在codeigniter中设置777的权限,但没有运气..这是我的项目链接http://mysports.orgfree.com . 使用此管理员帐户 .

用户名:mak密码:mak

登录并单击编辑按钮然后上传一些图像..错误将显示在那之后..谢谢...

2 回答

  • 0

    你好,你可以给2路许可

    1)使用这种方式直接给予文件夹权限

    chmod("folder name with path", 755);
    

    2)使用这种方式直接给出文件权限,并在move_uploaded_file函数后使用此代码

    chmod("file name with path", 644);
    
  • 0

    我能够通过使用SmartFTP上传文件来修复我的权限问题,因为它提供了一种设置权限的简便方法 . 这解决了我的问题,我的代码现在正常工作 .

相关问题