I’m trying to make an application that requires image uploading and storing, I’m using Express, Mongoose and Multer and trying to upload to MongoDB. Currently when I try to upload an image, Multer does create a folder and store the image in that folder, but it doesn’t save the item to the database and it crashes the server giving the
Tag: multer
How to validate multiple file uploads with multer expressjs
I have a problem with express.js and multer when I try to upload 2 valid images and 1 example pdf to validate is all images, it will upload that two images into a folder, and then it will throw the error for pdf that is an invalid format, can I somehow validate first all images and then do the upload
How to rename file in Multer middleware to data I am sending in request
On a frontend I am generating unique ID for every order. Idea is to rename file which user uploads to orderId. Here is my request to server: Here is the server code: console.log(req.body) shows empty object in filename and orderId in app.post(). Here is how it looks: So this cannot be done as far as I understand inside filename. How
Cannot POST image to my API Route from React.js
I am creating a MERN app in which I have created an api route /api/books where user can POST a book’s details with it’s image, and the data will be stored in MongoDB. I am using multer and it stores …
Cannot read property ‘path’ of undefined while uploading image upload on the frontend(react)
I am trying to upload an image on the frontend, but this is not working, I am getting the error below message: “Cannot read property ‘path’ of undefined” status: “fail” When I log …
multer npm: TypeError: Cannot read property ‘path’ of undefined
I have a problem uploading an image file to my server, I watched a tutorial on YouTube about multer and I do exactly the same thing that is done in the tutorial and for whatever reason I get an error: …