I want to give permission to some of my website users to download a specific file. the download needs to be resume support just for user convenience.
Bu nedenle bu kod parçası ile dosyayı güvenli aklıma geldi:
// Check for user session and privileges if it's okay continue
ob_end_clean();
$data = file_get_contents("c:\\newdata.pdf");
$showname = "newdata.pdf";
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment; filename=\"".$showname."\";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".strlen($data));
echo $data;
Sorun o da gonno zamanda bu hata mesajı alacaksınız da 134217728 bayt daha büyük dosyalar için büyük dosyalar için file_get_contents için gereken bellek bir sürü benim webserver büyük bir yükü vermek ve destek devam değil sadece şudur:
Allowed memory size of 134217728 bytes exhausted (tried to allocate 188862464 bytes)
Herhangi bir öneriniz?