Upload and Display Image Using NodeJS and Express w/Jade

The following code will allow an image to upload and then display on a NodeJS server with Express middleware.

Remember to add this to the config:

The following is needed to keep the image file extension and provide a directory for Express to write to. Alternatively the image will be uploaded to a .temp directory.

app.use(express.bodyParser({ keepExtensions: true, uploadDir: __dirname + '/public/uploads' }));

Code Example
Full code can be found here.

Leave a Reply

Your email address will not be published. Required fields are marked *