In this article

filter

jetpack_forms_file_field_max_upload_size

Filters the largest file a file upload field accepts, in bytes. Deliberately not bounded by the site’s own PHP upload limits. The browser sends each file straight to the upload endpoint, so `upload_max_filesize` and `post_max_size` have nothing to do with this transfer — clamping to them would cap the field at whatever a cheap host allows for files that host never receives. The bound that does matter is the endpoint’s own, which rejects anything over FILE_FIELD_MAX_UPLOAD_SIZE. So this filter can only lower the limit, never raise it: a larger value would have the field accept a file, show the visitor a size allowance in the “file is too large” message that nothing can honour, and then fail the upload once they had already waited for it. Raising the ceiling means raising it at the endpoint first. The result reaches the browser as the `maxUploadSize` config value, and the “file is too * large” message is built from the same number, so the two cannot disagree.

Parameters

$max_upload_size
int

Maximum size of a single file, in bytes.

Changelog

How to use this hook

See “How to use actions and filters to customize Jetpack”.