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 ;)