lostintranslation
lostintranslation

Reputation: 24583

File upload w/ expressjs v4.+

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?

Upvotes: 0

Views: 331

Answers (2)

Mick Cullen
Mick Cullen

Reputation: 9464

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

Upvotes: 0

ramonfritsch
ramonfritsch

Reputation: 46

formidable or busboy are options.

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

Upvotes: 1

Related Questions