2 years ago
I am using multer to upload images. The upload seems to work fine and here is the log output from a successful upload:
`/upload - req.file:
/upload - file: {
fieldname: 'file',
originalname: '4a3bd939-cb2d-439f-9676-713939259a98-1708372511310.png',
encoding: '7bit',
mimetype: 'image/png',
destination: 'public/images/',
filename: '4a3bd939-cb2d-439f-9676-713939259a98-1708372511310.png',
path: 'public/images/4a3bd939-cb2d-439f-9676-713939259a98-1708372511310.png',
size: 22059
}
File uploaded successfully`
When the clientside app makes a request to https://timetoplant-production.up.railway.app/assets/images/4a3bd939-cb2d-439f-9676-71393925 i get an error stating "Cannot GET /assets/images/4a3bd939-cb2d-439f-9676-71393925"
This works on my dev environment just fine. Not sure why it's not working on railway.
1 Replies
2 years ago
is your code set up to serve images at the /assets/images/ path from the saved location?
you will also want to make sure you are storing the uploaded files in a volume otherwise uploads won't persist between deployments.
here is an example multer demo https://github.com/brody192/multer-file-uploads