How to support IDM without allow request the page two times
I got this error ,as the above image show, while trying to download a file by IDM from my site. the limit of requesting this page one time only after entering Captcha Code and if you request the page again must enter the captcha code again.
How to support IDM in this case
The download code as the following
$file='test.mp3'; $download_rate = 50; //50 kb/s if(file_exists($file) && is_file($file)) { header('Cache-control: private'); header('Content-Type: application/octet-stream'); header('Content-Length: '.filesize($file)); header('Content-Disposition: filename='.$file); flush(); $file = fopen($file, "r"); while(!feof($file)) { // send the current file part to the browser print fread($file, round($download_rate * 1024)); // flush the content to the browser flush(); // sleep one second sleep(1); } fclose($file); } else { echo 'File Not Found'; }
Use xsendfile. A mod for apache
https://tn123.org/mod_xsendfile/
链接地址: http://www.djcxy.com/p/45514.html上一篇: PHP损坏的文件上传