Javascript-форум (https://javascript.ru/forum/)
-   Серверные языки и технологии (https://javascript.ru/forum/server/)
-   -   как передать новый url на скачку файла (https://javascript.ru/forum/server/45473-kak-peredat-novyjj-url-na-skachku-fajjla.html)

Vlasenko Fedor 13.03.2014 05:02

header("HTTP/1.1 200 OK");
        header("Connection: close");
        header("Content-Type: application/octet-stream");
        header("Accept-Ranges: bytes");
        header("Content-Disposition: Attachment; filename=screen.jpg"); //screen.jpg - имя файла
//получаем с помощью curl и отдаем на загрузку
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_URL, 'http://YouPath/FileName'); //указываем путь к внешнему ресурсу
        $data = curl_exec($ch);
        curl_close($ch);
        echo $data;
        exit;

danik.js 13.03.2014 12:36

Понимаешь, тс хочет и рыбку съесть, и в воду не лезть, так что твой вариант не подойдет )


Часовой пояс GMT +3, время: 20:11.