file download for private files
I have a FileUpload field in my form. It uploads to the local driver because the uploaded files are buying invoices which should only be downloadable and viewable by logged in users.
The ->downloadable() function returns a 404 not found. So I have made a controller to return the download from Storage. This function does work. Is there a way to replace the downloadable() url to this custom url so it downloads via the controller instead? Or is there another better way to handle these private files?
1 Reply
No that should suffice just make sure it's a one time temporary url
Here is an example what I did:
Then I format the URL to be an encrypted string of the path. You could chuck an array into the crypt and then test the path and then a time so you only allow it for X time and else return expired