Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle files and multipart/form-data #698

Closed
1 task
silvercent011 opened this issue Nov 27, 2022 · 4 comments
Closed
1 task

Handle files and multipart/form-data #698

silvercent011 opened this issue Nov 27, 2022 · 4 comments
Labels
documentation Improvements or additions to documentation h3

Comments

@silvercent011
Copy link

Describe the feature

Should be great have a feature like multer on express and handle multipart/form-data on readBody() hook.

Additional information

  • Would you be willing to help implement this feature?
@Hebilicious
Copy link
Member

Hebilicious commented Apr 25, 2023

This is supported by H3, so this should work already.

export default eventHandler(async event => {
const form = await readMultipartFormData(event)
// do stuff
})

Implemented here
https://github.com/unjs/h3/blob/5f503c23286e431a249bf379b6bb779d62e71059/src/utils/body.ts#L111

Copy link
Member

Leaving this opens until this is documented.

@Hebilicious Hebilicious added the documentation Improvements or additions to documentation label Jun 30, 2023 — with Volta.net
@Hebilicious Hebilicious added the h3 label Jun 30, 2023
@MickL
Copy link
Contributor

MickL commented Dec 26, 2023

@Hebilicious
Is it possible to limit what file types can be uploaded and what is the max file size? I see there is a type property but no file size.

Also I wonder if this counts as the documentation or is it still missing?
https://www.jsdocs.io/package/h3#readMultipartFormData

@Shyam-Chen
Copy link

https://h3.unjs.io/utils/request#readmultipartformdataevent

@pi0 pi0 closed this as not planned Won't fix, can't repro, duplicate, stale May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation h3
Projects
None yet
Development

No branches or pull requests

5 participants