zjh52hcl 发表于 2011-1-18 18:11:18

谁能帮忙解决一下上传文件后文件名的乱码问题

public function do_upload(){
                        $config['upload_path'] = './uploads/';
                        $config['allowed_types'] = 'rar|zip|7z|psd|ai|fla|doc|ppt|xls|txt|flv|f4v|mp4|mp3|wav|wmv|swf|jpeg|gif|jpg|png';
                        $config['max_size'] = '1000000000';
                        $config['max_width'] = '1024';
                        $config['max_height'] = '768';
                       
                        $this->load->library('upload', $config);
                       
                       
                        if ($this->upload->do_upload('file')){
                                return $this->upload->data();
                        } else{
                                $_SESSION['error_message'] = $this->upload->display_errors();
                        }
                }

Hex 发表于 2011-1-19 13:04:16

windows 系统只支持 GB2312,你的是 UTF-8 吧,用 iconv 转码。

zjh52hcl 发表于 2011-1-19 13:53:30

恩 谢谢已解决

zfm1988 发表于 2011-1-19 13:54:37

兄弟可以开启让ci为文件重新命名的吧!!

Icen 发表于 2012-4-12 11:53:46

Hex 发表于 2011-1-19 13:04 static/image/common/back.gif
windows 系统只支持 GB2312,你的是 UTF-8 吧,用 iconv 转码。

<?phpif ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Upload extends CI_Upload {

    public function __construct()
    {
      parent::__construct($props = array());
    }
}

?>

我想继承上传来转码,但是用以上代码继承后,上传就无法使用,提示“上传路径无效.” ??

Hex 发表于 2012-4-12 11:55:57

Icen 发表于 2012-4-12 11:53 static/image/common/back.gif
我想继承上传来转码,但是用以上代码继承后,上传就无法使用,提示“上传路径无效.” ?? ...

贴代码。和你继承的应该无关。是其他代码引起的。

Icen 发表于 2012-4-12 14:35:58

Hex 发表于 2012-4-12 11:55 static/image/common/back.gif
贴代码。和你继承的应该无关。是其他代码引起的。

{:1_1:} 还是算了,不转码了,文件名不使用中文。

四叶妹妹 发表于 2013-3-28 23:17:22

这个很邪恶啊,我也有这样的问题

单程车票 发表于 2014-5-3 11:00:44

Icen 发表于 2012-4-12 14:35
还是算了,不转码了,文件名不使用中文。

有时候想用中文啊。。。
比如名字是“微信名+时间”,,,必须有中文,还是得解决一下~
页: [1]
查看完整版本: 谁能帮忙解决一下上传文件后文件名的乱码问题