There is no suffix problem when uploading pictures on node.

upload pictures according to the rookie tutorial
pictures are uploaded to the static file, but there is no suffix. After adding .jpg manually, the picture can be displayed
for advice. How to make the upload successful have a suffix, thank you!
(it would be better if the picture name in the file is the original picture name)

clipboard.png

clipboard.png

clipboard.png

Mar.04,2021

app.use (multer ({dest: 'static'}). Array (' image')) leave this comment out, because the file storage is given below, so ok it with req.files below.


look at you. There should be no suffix when saving.


the default originalName does not have a suffix. When you write to a file, you can add the suffix name of the file, that is, the place circled in the figure

.

clipboard.png

Menu