mercredi 8 septembre 2021

How to convert stream to download laravel

            $stream = fopen('data://text/plain;base64,' . base64_encode($response),'r');
            $stat = fstat($stream);
            $size = $stat['size'];

            $type = "video/mp4";
            $start = 0;
            $length = $size;
            $status = 200;

            $headers = ['Content-Type' => $type, 'Content-Length' => $size, 'Accept-Ranges' => 'bytes'];

            return response()->stream(
                function() use ($stream, $start, $length) {
                    fseek($stream, $start, SEEK_SET);
                    echo fread($stream, $length);
                    fclose($stream);
                }, $status, $headers
            );

the above is working to stream a video but I need to download the video directly instead... any suggestions, please



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3BKaUAi
via IFTTT

Aucun commentaire:

Enregistrer un commentaire