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
OptionalmaxCount: 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
StaticAnyReturn 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.
Optionalstorage: StorageEnginestorage engine used for this middleware
OptionalallowedMineTypes: string | string[]Allowed mime types allowed for this multer instance
Optionallimits: {}Limits for the middleware
StaticArrayReturn 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
OptionalmaxCount: numbermaximum number of files
Optionalstorage: StorageEnginestorage engine used for this middleware
OptionalallowedMineTypes: string | string[]Allowed mime types allowed for this multer instance
Optionallimits: {}Limits for the middleware
StaticFieldsReturn 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
Optionalstorage: StorageEnginestorage engine used for this middleware
OptionalallowedMineTypes: string | string[]Allowed mime types allowed for this multer instance
Optionallimits: {}Limits for the middleware
StaticInstanceReturn a new instance of the multipart/form-data middleware
Optionalstorage: StorageEnginestorage engine used for this middleware
OptionalallowedMineTypes: string | string[]Allowed mime types allowed for this multer instance
Optionallimits: {}Limits for the middleware
StaticNoneReturn 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.
Optionalstorage: StorageEnginestorage engine used for this middleware
OptionalallowedMineTypes: string | string[]Allowed mime types allowed for this multer instance
Optionallimits: {}Limits for the middleware
StaticSingleReturn 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
Optionalstorage: StorageEnginestorage engine used for this middleware
OptionalallowedMineTypes: string | string[]Allowed mime types allowed for this multer instance
Optionallimits: {}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.