dongtangxi1584 2017-01-23 13:29
浏览 903

在iOs谷歌浏览器上下载文件时出现问题

I'm trying to force download a .zip archive using PHP code below:

$filePath = BASE_PATH . '/uploads' . $product->mainFile;

header('Pragma: public');
header('Expires: 0');
header('Cache-Control: no-cache');                                      
header('Content-Description: Download'); 
header('Content-Type: application/octet-stream'); 
header('Content-Disposition: attachment; filename="crazypatterns_' . $product->id . '.zip"');
header('Content-Transfer-Encoding: binary');
header('Content-Length: '.filesize($filePath));

This code works fine on all browsers and devices... except google chrome on iOs. When trying to download archive, on download page - an error occurs: "Cannot determine file size". Archive name is incorect and displays as 'login', and when download this file, filesize is determined incorrectly - 20-30KB, although it's real size is over 10MB. Screenshot with error occured - http://imgur.com/a/1Gr1L .

P.S. $filePath variable is correct, and given archive exists. Thanks ;)

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥20 腾讯企业邮箱邮件可以恢复么
    • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
    • ¥15 错误 LNK2001 无法解析的外部符号
    • ¥50 安装pyaudiokits失败
    • ¥15 计组这些题应该咋做呀
    • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
    • ¥15 让node服务器有自动加载文件的功能
    • ¥15 jmeter脚本回放有的是对的有的是错的
    • ¥15 r语言蛋白组学相关问题
    • ¥15 Python时间序列如何拟合疏系数模型