Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
386 views
in Technique[技术] by (71.8m points)

php 为什么上传png文件就报错?

layui前端上传
上传jpg就ok,只要上传png服务端就显示『The filetype you are attempting to upload is not allowed.』
服务端用的ci3 upload
`

public function upload()
{
    //var_dump($_FILES);
    $config['upload_path'] = '/home/wwwroot/abc/uploads/';
    $config['allowed_types'] = 'jpg|jpeg|png';
    $config['max_size'] = 10240;
    $config['max_width'] = 2048;
    $config['max_height']  = 1600;

    $this->load->library('upload', $config);

    if ( ! $this->upload->do_upload('file'))
    {
        echo $this->upload->display_errors();
    }
    else
    {
        header('content-type:application/json');
        echo ('{"code":"0","msg":"ok"}');
    }
}

`


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

这种问题,你直接找到报错的地方 dump 出当时的判断条件的内容,然后再逐一回溯就好了啊.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...