I have a form with 2 input field with type file and with different name attr. I wanna send these files and store it on my db, on the backedn i am using multer.
Now here is my form
<form aciton="/uploadFile" method="post" enctype="multipart/form-data" >
<input type="file" name="file1" required multiple />
<input type="file" name="file2" required multiple />
<input type="submit" value="Upload" />
</form>
On the backend this is my what i am doing
var storage = multer.diskStorage({
destination:(req,file,cb)=>{
cb(null,'./public/uploads');
},
filename:(req,file,cb)=>{
cb(null,file.originalname+'-'+Date.now())
}
})
The Problem is that if i name both input field same, then its working, otherwise its not working.