如何支持IDM而不允许请求页面两次
我在尝试通过 IDM 从我的网站下载文件时收到此错误,如上图所示。输入验证码后只能请求该页面一次,如果再次请求该页面则必须再次输入验证码。
这种情况下如何支持IDM
下载代码如下
$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'; }
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'; }
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 xsendfile。 apache 的 mod
https://tn123.org/mod_xsendfile/
Use xsendfile. A mod for apache
https://tn123.org/mod_xsendfile/