Where to store files
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
pick a safe storage location and naming.
Planned topics
- Never store uploads inside the JAR or the project folder; they vanish on redeploy and the folder may be public.
- Use a configured directory outside the application (
app.storage.dir), a mounted volume, or object storage such as S3 later (MID-056). - Generate the stored name yourself, for example a UUID, and keep the original name only as metadata.
- Keep a record (ID, original name, content type, size, stored name) in your data model.
- Do not rely on the local disk if you run several instances.
Draft outline details
Demonstration
record ImageRecord(id, productId, originalName, contentType, size, storedName); the file is stored as <dir>/<uuid>.
Check your understanding
Who chooses the stored file name?
Show answer
The server, never the client.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.