No Code Attached Yet bug
avatar paulkosciecha
paulkosciecha
27 Apr 2024

Steps to reproduce the issue

  • Set filesize limit in 4mb in Mediamanager settings
  • Upload file under 1mb - uploads fine
  • Upload file of 3.5mb - get error message that file is too large
  • Upload file of 8mb+ - get message saying file uploaded, blue line progresses, but no file appears

Expected result

Error reporting should be consistent with the scenario. It should not say the file is too large when it isn't bigger than the limits set in mediamanager - if these are lower than php. It should throw the error when the file is too big and not say it is uploaded.

Actual result

File is too big Error throws in scenerio where file is below the threshold. File uploaded message where the file is too big.

System information (as much as possible)

  • Joomla 4.4.0
  • Mamp server run locally as dev
  • php.ini - post_max_size = 8M, upload_max_filesize = 32M
  • Safari browser

Additional comments

avatar paulkosciecha paulkosciecha - open - 27 Apr 2024
avatar paulkosciecha paulkosciecha - change - 27 Apr 2024
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 27 Apr 2024
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 27 Apr 2024
avatar richard67
richard67 - comment - 28 Apr 2024

The 3.5 issue could be the result of rounding a float to an integer in combination with wrong logic so >= is used instead of > (which would be wrong of course, am just thinking about what could cause that).

avatar brianteeman
brianteeman - comment - 28 Apr 2024

Confirmed using Joomla 5.1

  • media manager set to 4mb

  • php Upload Max Filesize 100M

  • php Post Max Size 100M

Test 1 (filesmall.jpg 467kb) ✔️

image

Test 2 (filemed.jpg 3,792kb) ❌

image

Test 3 (filelarge.jpg 4,500kb) ✔️

image

avatar Quy Quy - change - 28 Apr 2024
Labels Added: bug
avatar Quy Quy - labeled - 28 Apr 2024
avatar mabdelaziz77
mabdelaziz77 - comment - 10 May 2024

I'm debugging this issue and found that the Upload function of the Media Manager is using the File: readAsDataURL() method where the file's data is represented as a base64 encoded string.

That means the size of the Base64 version of the file is typically roughly a third larger than its source, refer to Encoded size increase
For example if the file size is 3.5mb (3670016 bytes), the size of its Base64 version will be ~4881121 bytes.
In our case the filesize limit is set to 4mb (4194304 bytes), it is clear enough that the size of the Base64 version is larger than the filesize limit, so the upload is failed and says the file is to large to upload!

I tried multiplying filesize limit by 1.33 before checking the file size and it works:
$paramsUploadMaxsize = $params->get('upload_maxsize', 0) * 1024 * 1024 * 1.33;

but I'm not sure whether this is the best approach to handle it, please let me know your thoughts.

avatar EricdeWaal
EricdeWaal - comment - 20 Jun 2024

Hi, I have this issue too.
PHP and Media Manager's limits set to 100MB, which workt for files up to ~50 MB.
After that a blue progress line, even a success message, but no file uploaded.
On the other hand, if I upload a file with JCE I can go up to 95 MB as expected.
So it must be a Media Manager issue. On Joomla 4 and 5.

System1: PHP 8.1.29, Joomla 4.4.5
System2: PHP 8.2.20, Joomla 5.1.1

avatar EricdeWaal
EricdeWaal - comment - 21 Jun 2024

Update: when I set the memory_limit to 384 MB (the highest value that my hoster allows) the max file size that can be uploaded goes up a bit, but never comes even near 100 MB,

avatar Fedik Fedik - change - 21 Jun 2024
Title
Problem with error reporting in media manager - Joomla 4.4
Incorrect file size validation in media manager - Joomla 4.4
avatar Fedik Fedik - edited - 21 Jun 2024
avatar brianteeman
brianteeman - comment - 10 Aug 2024

I have converted the suggestion into a pull request for testing see #43899

avatar richard67 richard67 - change - 10 Aug 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-08-10 10:16:12
Closed_By richard67
avatar richard67 richard67 - close - 10 Aug 2024
avatar richard67
richard67 - comment - 10 Aug 2024

Closing as having a pull request. Please test #43899 . Thanks in advance.

avatar richard67
richard67 - comment - 11 Aug 2024

New pull request is #43906 . Please test. Thanks in advance.

Add a Comment

Login with GitHub to post a comment