79450
附件下载时的问题
回帖数 4
阅读数 4732
发表时间 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

相关帖子
孙晓松 | 最后回帖 2019-08-19 17:44 王林
陈硕峰 | 最后回帖 2017-12-08 09:20 王林
周昌和 | 最后回帖 2021-03-18 08:53 王林
邂逅之舟 | 最后回帖 2018-10-30 14:03 石洋洋
王先生 | 最后回帖 2017-10-25 11:29 石洋洋



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


