图像上传在byethost服务器中不起作用

Nil*_*yal 6 php codeigniter-3

我已经编写了关于图像上传的代码,但它在byexost服务器上不起作用.我在"uploads/products"服务器的根位置下创建了目录,该文件夹也是可写的,但它仍然无法正常工作.请帮忙.

我打开了应用程序的错误日志记录.如果我访问"application/logs"目录的日志文件,则显示错误.

错误 - 2018-03-25 00:47:08 - > 404找不到页面:/ index

错误 - 2018-03-25 00:58:24 - >上传路径似乎无效.

byexost服务器中图像上传目录的图片

在此输入图像描述

我的产品控制器代码.

if(isset($_FILES['productimage']['name'])){
    $filename = $_FILES['productimage']['name']; 
    $config['file_name'] = $filename;
    $config['upload_path'] = realpath(FCPATH.'uploads/products/');
    $config['allowed_types'] = 'jpg|jpeg|png';    
    $config['remove_spaces'] = TRUE;
    $config['encrypt_name'] = TRUE;
    $config['min_width'] = 360;
    $config['min_height'] = 360;
    $config['max_width'] = 360;
    $config['max_height'] = 360;
    $this->upload->initialize($config);
    if($this->upload->do_upload('productimage')){
        $uploadeddata = $this->upload->data();
        $data['image'] = $uploadeddata['file_name'];
    }else{
            $this->session->set_flashdata('error', $this->upload->display_errors());
            $result = array("status"=>false, "message"=>$this->upload->display_errors());
    }

}   
Run Code Online (Sandbox Code Playgroud)

Vic*_*rov 2

检查upload_tmp_dir权限(PHP 使用的用户权限)。本机文件上传分为两个步骤:上传到 tmp 目录并移动到您想要的任何位置。

另请确保您尝试上传的文件符合上传限制

  • 因为您的本地服务器使用本地 php.ini 和本地文件系统。尝试调查上传的整个路径 - 它将帮助您了解到底失败的原因。 (2认同)