79450
附件下载时的问题
回帖数 4
阅读数 4748
发表时间 2010-09-15 13:06:34
4个回复
这个是比较典型的ie下面的问题。ie下面,下载附件的文件名要进行urlencode。不是非常彻底的解决方案:
打开module/file/control.php,找到74行
72 if(file_exists($file->realPath))
73 {
74 $fileName = $file->title . '.' . $file->extension;
75 if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) $fileName = urlencode($fileName);
76 header('Content-Description: File Transfer');
77 header('Content-type: application/octet-stream');
78 header("Content-Disposition: attachment; filename=$fileName");
79 $fileData = file_get_contents($file->realPath);
80 echo $fileData;
81 }
82 $this->app->error("The file you visit $fileID not found.", __FILE__, __LINE__, true);
83 }
84 }
加入75行就可以了。
打开module/file/control.php,找到74行
72 if(file_exists($file->realPath))
73 {
74 $fileName = $file->title . '.' . $file->extension;
75 if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) $fileName = urlencode($fileName);
76 header('Content-Description: File Transfer');
77 header('Content-type: application/octet-stream');
78 header("Content-Disposition: attachment; filename=$fileName");
79 $fileData = file_get_contents($file->realPath);
80 echo $fileData;
81 }
82 $this->app->error("The file you visit $fileID not found.", __FILE__, __LINE__, true);
83 }
84 }
加入75行就可以了。
2010-09-15 15:38:17 王春生 最后编辑 2010-09-15 15:38:17 王春生 回帖
4个回复
用firefox一样有这个问题。
文件名是乱码,并且可能改变后缀,变成纯文本文档。不过文件内容是正确的,可以用正确的工具打开。
文件名是乱码,并且可能改变后缀,变成纯文本文档。不过文件内容是正确的,可以用正确的工具打开。
2010-10-15 09:57:19 prosup 回帖
联系我们
联系人
刘斌/高级客户经理
电话(微信)
17685869372
QQ号码
526288068
联系邮箱
liubin@chandao.com

相关帖子
IT_Yanjun | 最后回帖 2023-11-06 14:52 王林
不要命的火锅 | 最后回帖 2024-09-10 08:41 马超
热气腾腾的包子 | 最后回帖 2016-04-01 17:27 热气腾腾的包子
一身肌肉的皮带 | 最后回帖 2025-03-07 09:09 马超
牧青云 | 最后回帖 2024-04-26 10:16 禅道 - 闫敏
吕简荣 | 最后回帖 2018-10-17 16:10 石洋洋




精品资料包
1V1产品演示
免费试用增强功能
专属顾问答疑支持


