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 *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>