0

I am trying to move to express 4.+ and I am having trouble figuring out what I should do about file uploads.

Migration docs says I need to come up w/ an alternative but they don't really give an example. They also dropped support for a reason, which file upload package should I use?

Also read that you should not attach a form upload to every post by using:

app.use(multer(...));

Is there a good way to attach these to just a particular route?

lostintranslation
  • 23,756
  • 50
  • 159
  • 262

2 Answers2

1

formidable or busboy are options.

Expressjs 4.+ has lost this feature because it's not built on top of connect anymore.

bigmike7801
  • 3,908
  • 9
  • 49
  • 77
0

I use connect-busboy. I could not get 'busboy' to work. Other packages I came across but have never played with are 'flow' and 'parted'. There is also a npm package 'mongoose-file' which seems to let you add a file upload path to a mongoose Schema for upload to server. It may be handy if you are uploading other data to a MongoDB?

Basic connect-busboy and Formidable example using Express V4.2: Node/Express file upload

Community
  • 1
  • 1
Mick Cullen
  • 9,214
  • 3
  • 21
  • 17