expressjs / expressjs/multer

Uploadig multiple files with different requirements is not possible.

Open
#987 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.1k
Forks
1.1k
Avg merge
8d 2h
Merged PRs (30d)
21

Description

I have a route that expects a multipart form and in this multipart form, there are two files that are going to be uploaded.

1- a video file that should have a size limit of 2GB and is going to be directly saved on disk in `public/videos`

2- a thumbnail which is an image that should have a size limit of 20MB and is going to be saved in memory to be resized with sharp and saved into a different directory which is `public/video/thumbnails`

I tried to use `upload.fields([ { name: 'video', maxCount: 1 }, { name: 'thumbnail', maxCount: 1 } ])` . but it doesn't satisfy. These two files should have different size limits and I want one to be stored in disk directly and the other one in memory.

It looks like I need two different `multer().single()` on the same route.

Is it possible with multer to do this? or any other multipart parsers?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.