Answer the question
In order to leave comments, you need to log in
How to display a file in Laravel not by direct link?
I have a public disk in the file system, where there is a symbolic link.
I need some files to be available only to some users.
It occurred to me to create a separate disk, where there will be no symbolic link, that is, there will be no access through a direct link. And make a route, passing through which, the user is given access to the file.
I created the disk, uploaded the file there, there is no direct access to the file.
Created a route that checks if the user can access the file.
I wanted to display the file using "Storage::disk()->get()", however, as stated in the documentation, it produces a bare line of content.
And the question itself: How can I display a file for downloading not via a direct link? Or how can I turn a bare line of content into a file in order to display it for download?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question