multer https://blog.logrocket.com/multer-nodejs-express-upload-file/  - By default express dont support files in formdata so we need this module ```js const multer = require('multer'); const app = express(); // Create a multer instance and specify destination for uploaded files const upload = multer({ dest: 'uploads/' }); // Handle form data and file uploads using multer middleware app.post('/submit-form', upload.single('fileInput'), (req, res) => { // Access form data from req.body const formData = req.body; // Access uploaded file details from req.file const uploadedFile = req.file; // Process the form data and uploaded file // ... // Send a response res.send('File uploaded and form data received.'); }); // Start the server const PORT = 3000; app.listen(PORT, () => { console.log(`Server is running on port ${PORT}`); }); ``` req.file is js object like this ```js { fieldname: 'file', // Name of the form field specified in HTML originalname: 'photo.jpg', // Name of the file on the user's computer encoding: '7bit', // Encoding type of the file mimetype: 'image/jpeg', // The MIME type of the file destination: 'uploads/', // The folder where the file has been saved filename: '1714632000-photo.jpg', // The name of the file within the destination path: 'uploads/1714632000-photo.jpg', // The full path to the uploaded file size: 354612 // Size of the file in bytes } ``` - For multiple file uploads ```js app.post('/submit-form', upload.array('fileInputs', 3), (req, res) => { // Access form data from req.body const formData = req.body; // Access uploaded files details from req.files const uploadedFiles = req.files; ``` - For dynamic file fieldname ```js app.post('/submit-form', upload.any(), (req, res) => { // Access form data from req.body const formData = req.body; // Access uploaded files details from req.files const uploadedFiles = req.files; ``` Here 2nd argument in upload.array() ie 3 is optional. fileInputs is required name which is name of field containing files - Frontend part ```html