开发者

why this error happens with codeigniter fileupload?

this is my upload function

public function do_upload()
{开发者_如何学JAVA
    $config['upload_path'] = './upload/';
    $config['allowed_types'] = 'gif|jpg|png';

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

    if ( ! $this->upload->do_upload('customer_photo'))
    {
              $responce->success = false;
              $responce->data['error'] = $this->upload->display_errors();            
    }
    else
    {             
        $data = array('upload_data' => $this->upload->data());
                    $this->_do_resize($data);
    }
       echo json_encode($responce); 
}

this is the json what im seeing on firebug console

{"success":false,"data":{"error":"<p>The filetype you are attempting to upload is not allowed.&lt;\/p&gt;"}}</p>

any idea why its contain </p> and these &lt;\/p&gt; ?

Regards


According to the manual, $this->upload->display_errors() wraps the error messages in <p> tags.

You can pass parameters for the delimiters, to wrap the errors in what you want.

$this->upload->display_errors('', '');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜