Set the post_max_size and upload_max_filesize in PHP to 128M.
Set the maximum upload size in the Media Manager to 1M.
Use any extension with an upload field. The displayed limit is wrong (128M instead of 1M).
Uploading a 2M file fails.
We should be told the limit is 1M.
The displayed limit is wrong (128M instead of 1M).
| Labels |
Added:
No Code Attached Yet
|
||
I’ve run into this myself.
My configuration is:
post_max_size = 128Mupload_max_filesize = 80Mupload_maxsize = 20MI should be able to upload files up to 20 MB. Joomla, however, reports in the file field layout that the maximum upload size is 80 MB. If I try to upload a file larger than 20 MB it simply fails.
This isn’t an issue with my extension. My extension’s config.xml correctly declares an upload_maxsize field as required by Joomla, and the user sets the limit there. In my code I call \Joomla\CMS\Helper\MediaHelper::canUpload() to verify that a file is safe before uploading – this helper reads the value the user supplied for upload_maxsize.
The problem is that the FileField does not display the correct upload limit when it’s used in an extension that defines its own upload_maxsize. Instead, Joomla reports the PHP lowest limit (in my case, 80 MB). This is a bug.
In #12396 the function \Joomla\CMS\Utility\Utility::getMaxUploadSize() was changed to return only the minimum of post_max_size and upload_max_filesize, completely ignoring any extension‑defined upload_maxsize.
The same PR also altered the FileField layout so that always it shows the maximum file size allowed for upload. It pulls this value from \Joomla\CMS\Utility\Utility::getMaxUploadSize(), which, as noted, now returns an incorrect result. Moreover, there is no way to override or hide this display.
What you need is:
getMaxUploadSize() (or a new helper) that accepts that extension name, reads its declared upload_maxsize value, and returns the correct maximum upload size for that context.With these changes the FileField will correctly show and enforce the per‑extension upload limit, and the bug in Joomla will be resolved.
(Translated and rewritten with ChatGPT. It is better than my bad English.)
Thank you for providing more (and useful) information
| Labels |
Added:
bug
|
||
Thanks @leeroy1821
@brianteeman - This is the first bug report I have ever tried and I expected a few more steps after putting in my report (ie which version of Joomla this was in.) Also, it turns out the email on my github account was a super long time ago one (who know why I created a Github account back then) so emails were going to a mailbox I don't check very often. I've fixed that now.
@cybersalt what was the extension you were using where you experienced the problem. It will help to ensure a fix works correctly without breaking something at the same time
@brianteeman - Sorry for not replying sooner - I travelled late October and injured myself on the 30th and up until now pain and poor health has had me falling farther and farther behind things. Revisiting this now, I don't have the cooperation of the developer to help explain this better and I don't want to get stuck in the middle of something that I must admit I don't have my mind wrapped around even after an hour of trying to sort things out myself. Lol, I am not even getting what AI tries to explain and the example it created for me to demonstrate. So not wanting to be "that guy" who posts something irrelevant or unrelated, I think it's better for me to just tip my hat to @leeroy1821 who seems to have the issue much firmer in hand. I apologize for any static I have added by trying.
Are you sure it's not an issue with the extension. I only expect the media manager limit to be applied to the media manager component. All other extensions should either define their own limit or use the php settings. That's what happens for uploads with the template component