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.<\/p>"}}</p>
any idea why its contain </p>
and these <\/p>
?
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('', '');
精彩评论