Where to save (uploaded) files without loosing them on deploy #1552
Replies: 3 comments 1 reply
-
Build is transient - so those folders will be deleted :). You could version control build folders if need be, or create a distinct build repo to maintain build files in production. Depending on your use case that may be easier to revert (?), subject to additional build scripts (e.g. revert DB, or changes to files) and arguably cleaner approach. |
Beta Was this translation helpful? Give feedback.
-
I recommend saving them outside of the Application.makePath('../storage/uploads') The |
Beta Was this translation helpful? Give feedback.
-
After doing @thetutlage advises you, to retrieve the path of your file, you must create a route to access it : Route.get('uploads/services/:filename', async ({ response, params }) => {
const path = 'path_of_your_upload_folder'
response.download(Application.makePath(path, params.filename))
}) |
Beta Was this translation helpful? Give feedback.
-
Hi,
Application.tmpPath()
orApplication.publicPath()
return the directories under 'build'. But these directories will be deleted afternode ace build --production
. So where to save the files without losing then after a deploy? And how to serve it later (http://127.0.0.1/media/example.jpeg)?Thanks in advance and best regards,
Danny
Beta Was this translation helpful? Give feedback.
All reactions