Answer the question
In order to leave comments, you need to log in
How to play video from storage folder in Laravel?
I store files in a folder storage
to get photos using a package league/glide
, that is, in the tag <img>
I specify the route that works with photos. But what about the video, is there a simple solution?
The problem is that only the public
folder is available from the Internet, and the folder storage
is closed like others...
UPD:
sim3x In general, everyone, I just can't specify <source src="/storage/file.mp4" type="video/mp4">
`storage`, the folder is not available...
Answer the question
In order to leave comments, you need to log in
Create a route that will provide the necessary files on request.
Something like this:
Route::get('/videos/{filename}', function($filename){
$file = Storage::get('videos/'.$filename);
$mimetype = Storage::mimeType('videos/'.$filename);
return response($file, 200)->header('Content-Type', $mimetype);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question