1

Here's one that is driving me crazy:

  • PHP memory_limit: 512M
  • PHP post_max_size: 256M
  • PHP upload_max_filesize: 128M
$app = Factory::getApplication();
dd($app->getInput()->files->get('jform'));

Returns:

  • relevant data if upload a 32M .pdf file
  • null if I upload a 62M .pdf file

Any tips on why is this happening? Does

$app->getInput()->files
has any limit of max file size that supersedes PHP directives?

Many thanks.

2 Answers 2

3

It could be because the file is detected as unsafe by file filter in Joomla. Unfortunately, the file filter is prone to false-positives which is most likely what's happening in your case. If you have your own way of ensuring safety of the file, you can bypass Joomla's filter by setting the filter argument to RAW:

$app->getInput()->files->get('jform', null, 'RAW')
1
  • Thanks so much @Sharky. That was indeed part of the problem. The other one was the need for setting allow "unsafe" on File::upload($src, $dest, false, true); Nov 25, 2023 at 8:58
2

This is just one of Joomla frustrating:

works ok for small files, returns null on large files:

$app->getInput()->files->get('jform')

works ok for both small and large files:

$app->getInput()->files->getArray()['jform']

And just for clarification: it ALWAYS works if I use $_FILES instead for $app->getInput()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.