Next.js Discord

Discord Forum

correct way to upload picture more than 1mo in server action ?

Unanswered
tensefrogomar posted this in #help-forum
Open in Discord
Im trying to upload picture in server component but i have the issue :
' ApiError: Body exceeded 1 MB limit..... statusCode: 413'

on internet they are talking about

1 - Increase serverActions.bodyLimit in next.config.ts
2 - use a form server ?
3 ? - use some s3 ? i use minio for my small projects, don't know if that works ?
4 - i also thought of reducing file size before upload ?

I would like to know the correct way to upload picture more than 1mo please ?

Thank you for reading the post and helping me 🙂

3 Replies

Presigned urls
you generate a pre-signed url and send that to the client. Then the client uploads directly to that url instead of your backend