I am trying to use multer to upload file
I use latest multer (v.0.18)
I configure the app this way
var express = require('express')
, multer = require('multer')
, app = express()
, routes = require('./routes');
app.use(multer({ dest: './uploads/',
rename: function (fieldname, filename) {
return filename+Date.now();
},
onFileUploadStart: function (file) {
console.log(file.originalname + ' is starting ...')
},
onFileUploadComplete: function (file) {
console.log(file.fieldname + ' uploaded to ' + file.path)
done=true;
}
}).single('photo'));
and it keeps returning "Undefined is not a function" (referring to the .single() )
if I remove the .single to
multer({ dest: 'uploads/' });
this error message is gone, but of course the file itself becomes undefined then nothing is uploaded.
Work on it a day long, man! obviously need help :'(