It is recommended to use formidable. After my practice in the past few days, the API design of formidable is more reasonable and facilitates more customized operations. The most important thing is that it supports multiple file uploads. connect-busboy does not have the above advantages and does not support multipart
express
form add this:
enctype="multipart/form-data"
Quote
Routing
app.post('/movie/save',multipartMiddleware,Movie.savePoster,Movie.save)
node express has an upload plug-in that automatically parses, you just need to provide a directory and it’s very simple
Use formidable to parse uploaded images, simple and clear. Just check out the API of this module on npm
express uses connect-busboy to process the
of image uploadsmultipart/*
dataHere is a sample code demo
It is recommended to use formidable. After my practice in the past few days, the API design of formidable is more reasonable and facilitates more customized operations. The most important thing is that it supports multiple file uploads.
connect-busboy does not have the above advantages and does not support multipart
The image is passed in from the front end using the formdata object, and the stream is used to copy the image to the folder you want