Laravel - Where should I put user uploaded personal/sensitive documents?

- 1 answer

Ad

Currently, I am putting all files in my public directory which means that anyone can download the file.

However, I don't want anyone else to see that file other than the user who created it. As of right now, I have no control over that. Maybe if I store it in another directory, I will be using middleware to protect it.

But I'm stuck on the part where I can upload the user-uploaded files.

Where is the best directory to put them? I don't have an external server I just have a VPS.

Ad

Answer

Ad

Laravel has a storage folder designed especially for this case. It's not available from outside your server and you will have to serve the files from it through Laravel.

Ad
source: stackoverflow.com
Ad