expressjs / multer

Node.js middleware for handling `multipart/form-data`.
MIT License
11.62k stars 1.06k forks source link

diskStorage not a function #270

Closed thmoeller closed 9 years ago

thmoeller commented 9 years ago

Hi, i have following code

var express = require('express');        // call express
var app = express();
var multer  = require('multer');

var storage = multer.diskStorage({
  destination: function (req, file, cb) {
    cb(null, '/software/')
  },
  filename: function (req, file, cb) {
    cb(null, 'test.tar.gz')
  }
})

var upload = multer({ storage: storage })

.....

This gives me following error while compiling:

var storage=multer.diskStorage({
                   ^

TypeError: multer.diskStorage is not a function
    at Object.<anonymous> (D:\Harvester\proxy\proxy.js:34:20)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:457:10)
    at startup (node.js:136:18)
    at node.js:972:3

Tried all variations but it gives me always the same error. Using node 5.0

Any idea??

LinusU commented 9 years ago

Which version of multer is installed? Please make sure it's the latest...

thmoeller commented 9 years ago

Hi Linus,

thanks for your hint. Found an old reference in my package.json. Updated multer and works fine now.

Moe

LinusU commented 9 years ago

:ok_hand:

rahul7156 commented 8 years ago

thanks LinusU

GuntukuChaitanya commented 3 years ago

It is not working for me :(

MasterKanade commented 5 months ago

Hi I have the same error, I am using the latest multer version "multer": "^1.4.5-lts.1". Any Idea? why I am getting error: multer.diskStorage is not a function. Hi @thmoeller could you tell me which multer version are you using?

M-Shadil commented 3 months ago

hi , i also have latest version but is not working at all any one tell me the version?

patooz commented 2 hours ago

Latest version ( "multer": "^1.4.5-lts.1") but still gives the same error