Handling private file upload
How do you handle private file upload where the file shouldn't be accessible in the public storage ? In my case it's working but it's a bit messy, i have a separate model File and then have a morph relationship to every other model that has uploads, and then i use relationship on a FileUpload form component. I then generate a url with the id of the FileModel that points to a route that i made in which i check permission and return the file. This seems so messy, isn't there a cleaner/standard way of doing ?
2 Replies
Up
Doesn't this highly depend on each use case?
I just have a controller that checks whether a user can access the file and returns it