ci上传文件的功能问题
为什么我上传图片的时候它老是出现这个错误。。。。The filetype you are attempting to upload is not allowed.文件格式:$config['allowed_types'] = 'gif|jpg|jpeg|jpe|png';
但是我上传什么格式的图片它都是报同一个错误··求解 有高手可以解答吗···
如果是用普通表单上传,一般不会有问题,如果是用的swfupload,注意mime类型给这些都加上一个application/octet-stream 我是用普通表单上传的···
· array(1) { ["pro_img"]=> array(5) { ["name"]=> string(26) "QQ截图20120225121922.png" ["type"]=> string(9) "image/png" ["tmp_name"]=> string(49) "F:\110804\APMServ5.2.6\tmp\uploadtemp\php39DD.tmp" ["error"]=> int(0) ["size"]=> int(22095) } }
这是我var_dump出来的$FILES数组
把你处理上传部分的代码贴来看看。 本帖最后由 y_y 于 2012-2-25 15:53 编辑
if( ! empty($_POST)){
//var_dump($_POST);exit;
//var_dump($_FILES);exit;
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['max_size'] = '100000000000';
$config['max_width']= '102400000000';
$config['max_height']= '768000000';
$config['encrypt_name'] = TRUE;
$this->load->library('upload',$config);
if($this->upload->do_upload('pro_img')){
echo '上传成功!';
}
else{
echo '上传失败!';
$error = array('error' => $this->upload->display_errors());
var_dump($error);
}
exit;
$this->product_model->save($_POST);
} $this->upload->do_upload这里能var_dump出$error么。
之外,除了数字特别大,upload_path不是绝对路径,其他也看不出有什么问题。{:soso_e134:} 可以留下QQ吗····我想和你说一下·· 改 config/mimes.php 文件,具体请看论坛FAQ置顶帖。
页:
[1]
2