H
H
Hello World2021-10-13 14:31:55
MongoDB
Hello World, 2021-10-13 14:31:55

How to make the name of the saved file and the name that will be sent to the database the same, but at the same time unique?

Guys, such a problem, I have to save the file and it must have a unique name, just like the file name that is saved in the database.
But the process of generating the name of the FILE (multer filename) is now in the file user.routes.js, and the process of generating the name of the file that will be sent to the database file userController.js how can I make the file name that will be saved locally, and the name file that will be written to the database were uniquely the same?
I use nanoid

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question