请高手帮忙解决一下文件上传类上传中文名称文件的问题
我在上传非中文的文件时正常,但上传带有中文字符文件名的文件时,提示A problem was encountered while attempting to move the uploaded file to the final destination.很郁闷,找不到好的解决方案,请大家帮小弟一下,谢谢!我的代码:
function upload() {
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
/*
A problem was encountered while attempting to move the uploaded file to the final destination.
这个错误一般是上传文件的文件名不能是中文名,这个很郁闷!还未解决,大家可以用其它方法,重新改一下文件名就可以解决了!
*/
$config['max_size'] = '1024';
$config['max_width']= '1024';
$config['max_height']= '768';
$this->load->library('upload', $config);
if(!$this->upload->do_upload()) {
echo $this->upload->display_errors();
}
}
此帖来自:http://www.php.la/bbs/thread-102-1-1.html
请高手解释一下出错的原因和解决方法! 我想补充一下,如果不使用file_name和encrypt_name这两个参数,怎么实现中文名文件的上传呢? http://www.phpall.cn/forum/read.php?tid=178&fpage=2可以参考下这篇文章 你的帖子写的很不错,如果重命名的话,确实有些好处,但如果不重命名的话,怎么去修改呢?我试着在文件名加编码转换好像也不行啊!有没有方法上传中文图片不重命名呢? 中文不能上传多半是编码问题,windows 是gb编码,linux 是 utf-8 编码,试着用 iconv 转码试试。
ci 172 的上传类已经支持改名上传了。 暂时先改名上传吧,我继续研究一下,如果成功了,我把方法告诉大家! 谢谢xiaoniao 和 hex ,学习CI,支持CI!
页:
[1]