Как поддержать IDM без разрешения запроса страницы два раза - PullRequest
0 голосов
/ 31 марта 2011

error

Я получил эту ошибку, как показано на рисунке выше, при попытке загрузить файл IDM с моего сайта.Предел запроса этой страницы один раз только после ввода кода Captcha и если вы запрашиваете страницу снова, необходимо ввести код Captcha снова.

Как поддерживать 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';
}

1 Ответ

0 голосов
/ 02 апреля 2011

Использовать xsendfile. Мод для apache

https://tn123.org/mod_xsendfile/

...