multer Archives - wiki

Nodejs Express GET POST Multipart request handling example

Nodejs Express GET POST Multipart request handling example

Create a new with nodejs and express (check this post for how to create node express project)


  1. create an empty folder in root of your application
  2. install requires node packages (I have added all the node packages in package.json so you can simply run npm install it will take care of this)

index.js this is my app entry point.

routes.js :- I have made a separate rout file that’s why the routs.js file (Check this post for how to make separate rout file) otherwise you can directly add this code into your entry point file (in my case index.js)

I am using the multer node package for handing multipart request



It is ready open your browser and test it


You can see the file is uploaded, but it is using some random name for the file.

For changing file name we can make a small configuration changes in routs.js. Insted of  ‘var upload = multer({ dest: ‘./uploads/’ });’ add the new configuration settings



ref :

By bm on August 19, 2016 | Express, NodeJs | A comment?
Tags: , , , , , ,