-1

Hey guys I want to download videos from an external link I have a field in database and this is video link. I wrote :

return response()->download(url()->to($video->path));

but it gives me this error: Download File ERROR MESSAGE = The file http://example.com/video_link" does not exist

while when I wrote this link in address bar in browser it shows video correctly to me. How I can download a video with external link very fast ?

1 Answers1

0

No unfortunately they didnt solve my problem. when I wrote this code:

$filename = $video->video_id;
$tempFile = tempnam(sys_get_temp_dir(), $filename);
copy($video->path, $tempFile);
header("Content-Disposition: attachment; filename = ".$filename);
header("X-Accel-Redirect: ".$filename);
return response()->download($tempFile, $filename);

I got 504 nginx error :(