Accept an array of files, all with the name fieldName. Optionally error out if more than maxCount files are uploaded. The array of files will be stored in req.files
name of file
Optional
maxCount: numbermaximum number of files
Accept a mix of files, specified by fields. An object with arrays of files will be stored in req.files.
array of entries
Accept a single file with the name fieldName. The single file will be stored in req.file
name of the file
Static
AnyReturn a new instance of the multipart/form-data middleware that accepts all files that comes over the wire. An array of files will be stored in req.files.
Optional
storage: StorageEnginestorage engine used for this middleware
Optional
allowedMineTypes: string | string[]Allowed mime types allowed for this multer instance
Optional
limits: {}Limits for the middleware
Static
ArrayReturn a new instance of the multipart/form-data middleware that accepts an array of files, all with the name fieldName. Optionally error out if more than maxCount files are uploaded. The array of files will be stored in req.files
name of the file field
Optional
maxCount: numbermaximum number of files
Optional
storage: StorageEnginestorage engine used for this middleware
Optional
allowedMineTypes: string | string[]Allowed mime types allowed for this multer instance
Optional
limits: {}Limits for the middleware
Static
FieldsReturn a new instance of the multipart/form-data middleware that accepts a mix of files, specified by fields. An object with arrays of files will be stored in req.files.
array of entries
Optional
storage: StorageEnginestorage engine used for this middleware
Optional
allowedMineTypes: string | string[]Allowed mime types allowed for this multer instance
Optional
limits: {}Limits for the middleware
Static
InstanceReturn a new instance of the multipart/form-data middleware
Optional
storage: StorageEnginestorage engine used for this middleware
Optional
allowedMineTypes: string | string[]Allowed mime types allowed for this multer instance
Optional
limits: {}Limits for the middleware
Static
NoneReturn a new instance of the multipart/form-data middleware that accepts only text fields. If any file upload is made, error with code "Unexpected field" will be issued.
Optional
storage: StorageEnginestorage engine used for this middleware
Optional
allowedMineTypes: string | string[]Allowed mime types allowed for this multer instance
Optional
limits: {}Limits for the middleware
Static
SingleReturn a new instance of the multipart/form-data middleware that accepts a single file with the name fieldName. The single file will be stored in req.file
name of the file field
Optional
storage: StorageEnginestorage engine used for this middleware
Optional
allowedMineTypes: string | string[]Allowed mime types allowed for this multer instance
Optional
limits: {}Limits for the middleware
Multer middleware wrapping for multipart/from-data
Remarks
WARNING: Make sure that you always handle the files that a user uploads. Never add multer as a global middleware since a malicious user could upload files to a route that you didn't anticipate. Only use this function on routes where you are handling the uploaded files.