User tests: Successful: Unsuccessful:
Pull Request resolves #46267 .
The FileField currently displays the maximum upload size calculated from the PHP post_max_size and upload_max_filesize settings, but provides no way for an extension to specify a lower, field-specific upload limit.
This change adds support for a maxsize attribute to the FileField while still respecting the limits imposed by the PHP configuration.
For example:
<field
name="file"
type="file"
maxsize="20M"
/>
The displayed limit will be the lower of the field's maxsize value and the PHP upload limits.
Add a field to an existing form for example
<field
name="file"
type="file"
maxsize="20M"
/>
Open the form containing the file field.
Verify that the displayed maximum upload size is 20 MB.
Try again with a size greater than the php max upload size - verify that the diplayed maximum is now the php size and not the size from tyhe field definition
The FileField always displays the maximum upload size calculated from the PHP configuration.
A FileField can specify an extension-specific maximum upload size using the maxsize attribute.
The displayed maximum is the lowest of:
Existing FileField definitions without a maxsize attribute continue to use the existing PHP-derived limit.
Please select:
Documentation link for guide.joomla.org:
No documentation changes for guide.joomla.org needed
Pull Request link for manual.joomla.org: 734
No documentation changes for manual.joomla.org needed
| Status | New | ⇒ | Pending |
| Category | ⇒ | Layout Libraries Unit Tests |
| Title |
|
||||||
I have tested this item ✅ successfully on f91b587
Works as expected.
I have tested this item ✅ successfully on f91b587
I have tested this item ✅ successfully on f91b587
| Status | Pending | ⇒ | Ready to Commit |
RTC
RTC
shouldn't this new option be documented in the manual? https://manual.joomla.org/docs/next/general-concepts/forms-fields/standard-fields/file/
Yes I can add that
documentation added joomla/Manual#734
Thanks!
| Labels |
Added:
RTC
Unit/System Tests
PR-6.3-dev
|
||
I am closing this as on closer review it doesnt actually achieve what i intended - it just displays the reduced limit - it doesnt actually enforce it
| Status | Ready to Commit | ⇒ | Closed |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2026-11-16 22:14:58 |
| Closed_By | ⇒ | brianteeman |
or should i just make the documentation clearer?
We could accept this PR as is but with corrected documentation
the documentation currently says
Note 2: You can put a soft limit file size by adding a hidden field with name="MAX_FILE_SIZE" and value the maximum allowed bytes which is handled by php, but you must also handle it in your code with or without it.
We could accept this PR with the documentation changed to
maxsize (optional) Specifies a maximum file size to display to the user.
Note 2: The maximum file size displayed is the lowest of:
| Status | Closed | ⇒ | New |
| Closed_Date | 2026-11-16 22:14:58 | ⇒ | |
| Closed_By | brianteeman | ⇒ | |
| Labels |
Removed:
RTC
|
||
| Status | New | ⇒ | Pending |
I leave it to maintainers to decide if this should be merged
I have tested this item ✅ successfully on f91b587
Works as expected.
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48522.