Friday, 15 August 2014

node.js - Nodejs query for uploading photos -



node.js - Nodejs query for uploading photos -

i new nodejs. using express, , have create form upload photos. far have created file called upload.handlebars have written next code:

<form enctype="multipart/form-data" action="uploads" method="post"> <input type="file", id = "image", name="image", accept="image/*"> <input type='submit' id='tags' value='upload'>

i have file called router.js have written post function. 1 of lines in post function is:

fs.readfile(req.files.image.path, function (err, data) {

however, error follows:

typeerror: cannot read property 'image' of undefined @ object.handle....

how should specify 'name' of image file in router.js?

make sure have multiparty middleware enabled.

https://github.com/andrewrk/connect-multiparty

latest express doesn't come it.

node.js

No comments:

Post a Comment