javascript - angular-file-upload not adding file to the request -


I am using the server running the node to upload a picture and express it to 4.0 and file me There is a problem coming in to data on Ever.

This is the relevant code:

  & lt; input type = "file" ng-file-select = "select onfile ($ files)" & gt;   

angular controller:

  $ scope.onFileSelect = function ($ files) {var file = $ files [0]; // [..] Verification $ scope.upload = $ upload.upload ({url: 'API / settings / photo', method: 'post', file: file, header: {'content-type': undefined}} ). Progress (avt) {$ scope.percent = parseInt (100.0 * evt.loaded / evt.total);}) Success (work (data) {console.log (data);}) Error (task () {console.log ('error');}); };   

Server code:

  // Image app. Root ('/ api / settings / picture') .post (middleware.auth, users.change images);   

Root handler:

  export.changePicture = function (req, res) {var userId = req.user._id; Console.log (req.files); };   

req.files always undefined

Why can any idea?

The problem was due to a change in Express 4.0.

I solved it using it.

More information on this post:

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -