wangjin 发表于 2012-1-30 11:31:39

使用CI上传图片提示 类型不允许

提示 The filetype you are attempting to upload is not allowed.

function do_upload() {
                //echo getcwd().'\uploads';
                //exit;
                $config ['upload_path'] = './uploads/';
                $config ['allowed_types'] = 'gif|jpg|jpeg|png|';
                $config ['encrypt_name'] = true;
                $config ['max_size'] = '1000';
                $config ['max_width'] = '1024';
                $config ['max_height'] = '768';
                $this->load->library ( 'upload', $config );
                if (! $this->upload->do_upload ()) {
                        $error = array ('error' => $this->upload->display_errors () );
                       
                        $this->load->view ( 'upload_form', $error );
                } else {
                        $data = array ('upload_data' => $this->upload->data () );
                       
                        $this->load->view ( 'upload_success', $data );
                }
        }

Hex 发表于 2012-1-30 12:05:30

看这里 http://codeigniter.org.cn/forums/thread-442-1-1.html

wangjin 发表于 2012-2-2 11:44:01

修改mimes没效果.gif,jpg都不行

loadinger 发表于 2012-2-2 12:47:38

mime在各浏览器里得到的不一定是一样的。所以最好多试一下。。
页: [1]
查看完整版本: 使用CI上传图片提示 类型不允许