I am developing a Node.js/Express application and need to handle file uploads from users. I am aware that the public folder is typically used for static assets that should be accessible directly by users. However, I want to ensure that user-uploaded files are stored securely and are not exposed to unauthorized access.
Although I know that cloud storage solutions are an option, I am focusing on handling file uploads directly on the server.
Should user-uploaded files be stored in a separate folder from the public directory?
For example, should public files be in the public folder, while user uploads are kept in a different, secured folder?
Moh dwi Ramdhani is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.