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

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37e8c-e61f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37e8c-e61f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?