0

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

MattJ
  • 7,924
  • 1
  • 28
  • 33
Suresh kumar
  • 2,002
  • 1
  • 19
  • 28
  • I once had problems with download as well, check out the question may contain usefull information to help you solve it: http://stackoverflow.com/questions/9944869/forced-file-download-iscorrupted – eric.itzhak May 21 '12 at 11:33
  • If you download a 65MB file, does the download software (Browser or download accelerator) shows the progress and does it complete (100%) at 35MB ? – AKS May 21 '12 at 11:38
  • Ok i will try as you suggest Ayesh Karunaratne – Suresh kumar May 21 '12 at 11:39
  • have a look at the web server's error log file, it may have entries that will help you figure out what's going on – periklis May 21 '12 at 12:45

1 Answers1

0

Anyone have idea on this? I use Download Manager to download a file . When it reach 65% it shows Error message as "Data Transfer has been interrupted and the server doesnot support resume. Its only possible to download from the beginning"..

How to resolve this?

Suresh kumar
  • 2,002
  • 1
  • 19
  • 28