correct way to upload picture more than 1mo in server action ?
Unanswered
tensefrogomar posted this in #help-forum
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 🙂
' 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
@tensefrogomar 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 🙂
First of all, yes, compress the file by default, and convert it to a file format which takes lower storage, it should automatically fix the issue.
Additionally, Its better if you use s3 or somethin similar with signed URL so you don't get data transfer charges from your server to the storage service
Additionally, Its better if you use s3 or somethin similar with signed URL so you don't get data transfer charges from your server to the storage service
you generate a pre-signed url and send that to the client. Then the client uploads directly to that url instead of your backend