cannot handle image uploads using expressjs

I am using express v2.5.8. I am uploading a file from a multipart form where the file input in the form is classified as a file:

Form: enctype="multipart/form-data"

Element: type='file'

Within the server side app, I have set the following: app.use(express.bodyParser({uploadDir:'./files/ph'})), //valid directory and no write issues

I have also required the 'fs' module.

Within the form handling route, I can see req.body but when I try to access req.files, it seems to be undefined & when I check the req.is('image'), the result is false.

Any suggestions on handling image uploads from a html form handled via express would be appreciated.

Thanks in advance.

Answers


I switched to node-formidable and it works for me - I will check above logic again once I use express v3.0/connect v2.0 (it seems like req.files for multipart data is available in express 3.0/connect 2.0 though I am not entirely certain so please do your own due diligence about it).


Need Your Help

method name part of same singleton class?

iphone ios singleton

I have a class, in that class I have set up a singleton patter and have a method, here is a short example of what it looks like.

Convert current .vssettings to .vstheme for VS 2013

visual-studio visual-studio-2013 themes vssettings

I have downloaded the Visual Studio 2013 Color Theme Editor and a fonts/colors theme in the form of a .vssettings file (from here). I want to be able to edit the file in the Color Themes window/tab...