I have written code to download audio files. When I try to download a file more than 50MB through PHP, it does not download completely. It downloads a maximum of 45MB. Every time I try to download, the download size varies from 36MB to 45MB.
I have changed the configuration in php.ini as follows:
memory_limit 512M
post_max_size 512M
upload_max_filesize 512M
In phpinfo()
, its show the above value after I change the configuration. Still I have the same problem.
I use the following code to download:
<?php
$file = "file to download";
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
readfile($file);
?>
Help me to resolve this
Thanks