how can i display the file size limit after admin uploads , currently it just shows me a error "There was a problem uploading the file
hi @eloahsam - currently it is not possible to customize this error message, but I think it would be great to give more detailed information for upload errors. Feel free to open a feature request to improve upload error messages.
In the meantime, you could add an admin description to your uploads collection / fields stating the max file size.
Not sure how to access the allowed filesize, but if you're interested in making a PR @eloahsam check out...
https://github.com/payloadcms/payload/blob/812ab9f86824aca3689ddef8af759a84f59f2148/src/errors/FileUploadError.ts#L5
Which is only called in two files it seems like
https://github.com/payloadcms/payload/blob/812ab9f86824aca3689ddef8af759a84f59f2148/src/uploads/generateFileData.ts#L159
and
https://github.com/payloadcms/payload/blob/812ab9f86824aca3689ddef8af759a84f59f2148/src/uploads/uploadFiles.ts#L14
maybe @jesschow knows how to access the fileSize via the Payload object in the FileUploadError
The file size error should show even before calling any api etc,from the two links I see that you’ve sent it’s after api calls as these are file upload errors …so the input file size should also give a error aswell
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.