DEV Community

António Avelar
António Avelar

Posted on

(NodeJS + Express + Multer) Any suggestions of how can i serve user uploaded files?

Hi!, i'm building a Web App where a user can upload pictures. For the task of receiving the binary files i'm using Multer.
So... Multer stores the pictures in the filesystem by default without the file extension. I'm storing the file data (original name, mimetype, extension, path, ...) in the database.

How should i serve those files to the user?
Should i use a route, that gets the image data (extension, mimetype, ...) and then sends the file with the right mime type?
Or should i use the express.static("path/to/folder")?

Top comments (0)