手机端下载文件及上传文件

TomyGuan 2016-03-25 06:25:00
用PHP实现了在电脑端的上传及下载文件,但在手机端完全不能使用,大伙给个想法或源码,谢谢!

下载在电脑端是这样实现的,但在手机端不能用
ob_start();
$this->image();
$s = ob_get_clean();
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: application/force-download");
//header("Content-type:application/octet-stream;");
header("Accept-Ranges:bytes");
header("Content-Type:text/html;charset=utf-8");
header('Content-Length: '.strlen($s));

$ua = $_SERVER["HTTP_USER_AGENT"];

$filename = “abc.jpg";

$encoded_filename = urlencode($filename);
$encoded_filename = str_replace("+", "%20", $encoded_filename);

if (preg_match("/MSIE/", $ua)) {
header('Content-Disposition: attachment; filename="' . $encoded_filename . '"');
} else if (preg_match("/Firefox/", $ua)) {
header('Content-Disposition: attachment; filename*="utf8\'\'' . $filename . '"');
} else {
header('Content-Disposition: attachment; filename="' . $filename . '"');
}
header("Content-Transfer-Encoding: binary");
echo $s;
...全文
134 回复 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

3,156

社区成员

发帖
与我相关
我的任务
社区描述
微信开发即微信公众平台开发,将企业信息、服务、活动等内容通过微信网页的方式进行表现,通过二次开发可以将公众账号由一个媒体型营销工具转化成提供服务的产品。
社区管理员
  • 微信开发
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧