wing1314 发表于 2011-1-11 10:28:40

诡异The filetype you are attempting to upload is not allowed.


$filename = $_FILES[$field_name]['name'];
   #正则表达式匹配出上传文件的扩展名
   preg_match('|\.(\w+)$|', $filename, $ext);
   #print_r($ext);
   #转化成小写
   $ext = strtolower($ext); //扩展名

    $upload_path = './uploads/post_photo';
   $image_name = $post_id.'_big'.$ext;



$config['upload_path'] = $upload_path;
//$config['allowed_types'] = $this->config->item('cfg_imgtype');
$config['allowed_types'] = 'jpg';
$config['file_name'] = $image_name;
$config['max_size'] = '2048';
$config['overwrite']= TRUE;


上传linux服务器运行报错The filetype you are attempting to upload is not allowed.

本地却正常求救啊

wing1314 发表于 2011-1-11 10:32:10

本帖最后由 wing1314 于 2011-1-11 10:59 编辑

ci上传控件需要什么服务器环境支持吗?

lianghan 发表于 2011-1-11 10:38:16

本帖最后由 lianghan 于 2011-1-11 10:57 编辑

会不会是扩展名问题,打断点输出一下 $ext;补充 (看看上传的路径)

wing1314 发表于 2011-1-11 10:59:00

刚试过$config['file_name'] = $image_name;注释掉

不要重命名就OK

诡异

xpengzp 发表于 2011-2-1 15:24:43

本帖最后由 xpengzp 于 2011-2-5 20:16 编辑

重命名上传文件名解决方法,
http://codeigniter.org.cn/forums/thread-7806-1-1.html
页: [1]
查看完整版本: 诡异The filetype you are attempting to upload is not allowed.