jeudi 13 août 2020

Laravel 5.4 download video with correct file type not working

I'm trying to download an mp4 file from server using the code below but file give error on play after download.

Error screenshot

Following is the code I'm using:

$file= "/var/www/html/videos/$vid.$type";
$headers = array(
    "Content-Type: video/$type",
);
return Response::download($file, "video-$vid.$type", $headers);

In view:

<a target="_blank" href="https://example.com/account/merchant/video-reviews/download/96066745/mp4" class="download_video"><i class="fa fa-download"></i>Download Video</a>

Everything works well and file also get downloaded but enable to play it because of error attached.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire