хочет сделать редирект на страницу в файл
function downloadFile($url) {
... // save info to database
$path = ..; // checking if the file is on the local server
if(empty($path) === false) {
// download file from local server - it works
header("Content-Description: File Transfer");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"". basename($path) ."\"");
readfile($path);
exit;
}
// downloading a file from another server - it does not work, $url is 100% good
header("Location: " . $url);
exit;
}
но файл не выкидывается на экран, я вижу этот файл только во вкладке Сеть
eq:
...file?id=123 // first page run header("Location: " . $url); exit;
и редирект на страницу с другого сервера
...download_file?id=123 // status 302
...file.pdf // status 302
...file.pdf // status 200
заголовок последней страницы
HTTP/1.1 200 OK
Date: Wed, 30 Dec 2020 15:45:21 GMT
Server: Apache
Last-Modified: Wed, 30 Dec 2020 16:38:38 GMT
ETag: "1a8f32-5b7af7b443bf7"
Accept-Ranges: bytes
Content-Length: 1740594
Content-Disposition: attachment
Content-Type: application/force-download
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
почему он не отображает файл на экране? почему не начинает скачиваться? в инструменте есть только информация (вкладка Сеть)