This is error which am getting while post data and file. I have followed \'academind\' tutorial for building Restful API services, also i have been searching answer for this
This what worked for me. I changed './uploads/' into '__dirname' so that it can find the correct directory/filename anywhere on your computer.
const storage = multer.diskStorage({
destination: function(req, file, cb) {
cb(null, __dirname);
},
filename: function(req, file, cb) {
cb(null, new Date().toISOString() + file.originalname);
}
});
Because when you set a specific folder name/directory you limit your image directory to be only or should be in that folder.