javascript - Multer new version, undefined uploaded images file -


when uploaded image multer middle ware, got undefined file image. in other words, cannot name or file extension file uploaded. don't know if error multer. here js file:

var express = require('express');  var multer = require('multer');  var upload = multer({dest:'uploads/'});  var router = express.router();    router.post('/register', upload.single('profile'), function(req, res, next){      if(req.file){      console.log("uploading files");      //get properties of files object       var profileimageoriginalname = req.file.profile.originalname;      var profileimagename = req.file.profile.name;      var profileimagemime = req.file.profile.mimetype;      var profileimagepath = req.file.profile.path;      var profileimageext = req.file.profile.extension;      var profileimagesize = req.file.profile.size;  }

and here html form file in jade format:

input.form-control(name = 'profile', type = 'file')

the type error : cannot read originalname of undefined

for .single(), req.file contains file properties directly (e.g. req.file.originalname).


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -