Good evening,
I have a problem with the module. It does not take into account the file size and stops at the size defined in the php.ini.
And when I set a file size there is an error message.
I am using Drupal 10.1.8 and PHP 8.1.23
the error message is as follows :
-----
Le site Web a rencontré une erreur inattendue. Veuillez essayer de nouveau plus tard.
TypeError: abs(): Argument #1 ($num) must be of type int|float, string given in abs() (line 137 of core/includes/common.inc).
format_size('400 MB') (Line: 156)
template_preprocess_file_upload_help(Array, 'file_upload_help', Array)
call_user_func_array('template_preprocess_file_upload_help', Array) (Line: 285)
Drupal\Core\Theme\ThemeManager->render('file_upload_help', Array) (Line: 445)
Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 204)
Drupal\Core\Render\Renderer->render(Array, 1) (Line: 148)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 592)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 149)
Drupal\Core\Render\Renderer->renderRoot(Array) (Line: 70)
Drupal\file_resup\Form\FileFormAlterBase::managedFileProcess(Array, Object, Array) (Line: 23)
Drupal\file_resup\Form\FileWidgetFormAlter::managedFileProcess(Array, Object, Array)
call_user_func_array('Drupal\file_resup\Form\FileWidgetFormAlter::managedFileProcess', Array) (Line: 1012)
Drupal\Core\Form\FormBuilder->doBuildForm('node_aaa_edit_form', Array, Object) (Line: 1075)
Drupal\Core\Form\FormBuilder->doBuildForm('node_aaa_edit_form', Array, Object) (Line: 1075)
Drupal\Core\Form\FormBuilder->doBuildForm('node_aaa_edit_form', Array, Object) (Line: 1075)
Drupal\Core\Form\FormBuilder->doBuildForm('node_aaa_edit_form', Array, Object) (Line: 579)
Drupal\Core\Form\FormBuilder->processForm('node_aaa_edit_form', Array, Object) (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 592)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
-----
Thank you in advance for any feedback you may have.
Stéphen
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | 3418177-20.patch | 11.34 KB | ricovandevin |
| #18 | filesize_column_too_small_for_laarge_files.png | 214.7 KB | s_leu |
Issue fork file_resup-3418177
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
ratanasdiabolo commentedComment #3
anrikun commentedComment #4
ratanasdiabolo commentedGood evening,
Still no one with this type of problem?
The module does not work at all. If I put a max value of file, I have an error and if I don't put rioen, it does not take a file greater than the value of php.ini, that is to say 128 MB.
I don't understand…
I upgraded to php 8.2.10 but that doesn't change anything
Comment #5
dineshkumarbollu commentedHi @ratanasdiabolo
Can you add steps to reproduce the issue, I will check the issue if you provide.
The reason might be upload size in code is taking as string '400' instead of int 400.This is the method where file size is passing, can you provide steps to reproduce i will debug the issue.Thanks
Comment #6
ratanasdiabolo commentedGood morning,
Thank you very much for watching.
In fact, I normally install the module then when I drop files greater than the php.ini limit, the site displays an error message.
When I put a transfer value of 600 MB for example in the parameters of my field, I get an error like this:
---------------------------------
The website encountered an unexpected error. Please try again later.
TypeError: abs(): Argument #1 ($num) must be of type int|float, string given in abs() (line 137 of core/includes/common.inc).
format_size() (Line: 157)
template_preprocess_file_upload_help()
call_user_func_array() (Line: 285)
Drupal\Core\Theme\ThemeManager->render() (Line: 433)
Drupal\Core\Render\Renderer->doRender() (Line: 204)
Drupal\Core\Render\Renderer->render() (Line: 148)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 149)
Drupal\Core\Render\Renderer->renderRoot() (Line: 70)
Drupal\file_resup\Form\FileFormAlterBase::managedFileProcess() (Line: 23)
Drupal\file_resup\Form\FileWidgetFormAlter::managedFileProcess()
call_user_func_array() (Line: 1012)
Drupal\Core\Form\FormBuilder->doBuildForm() (Line: 1075)
Drupal\Core\Form\FormBuilder->doBuildForm() (Line: 1075)
Drupal\Core\Form\FormBuilder->doBuildForm() (Line: 1075)
Drupal\Core\Form\FormBuilder->doBuildForm() (Line: 579)
Drupal\Core\Form\FormBuilder->processForm() (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 163)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 74)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 686)
Drupal\Core\DrupalKernel->handle() (Line: 19)
---------------------------------
I am under :
Drupal 10.0.9
PHP Version 8.1.27
Database Version 10.6.17-MariaDB
Memory ceiling of PHP 2048M
I also have a version under:
Drupal 10.1.8
PHP Version 8.2.10
Database
Version 5.7.42-log - MySQL system, Percona Server, or equivalent
Memory ceiling of PHP 512M
But it's the same. It does not work.
Thank you in advance for your help.
Stephen
Comment #7
ratanasdiabolo commentedin the watchdog, I have this:
TypeError: abs(): Argument #1 ($num) must be of type int|float, string given in abs() (line 137 of /home/njbo5967/gihpnormandie2023/web/core/includes/common.inc).
Comment #10
tim bozeman commentedThank you for the bug report!
At some point core changed their file validator names from things like
file_validate_sizeto['FileSizeLimit']['fileLimit']. We tried to support both the old and new validator names, but evidently it wasn't working for the new ones. Let's just remove the old validator names and move on. I think there's been enough time for most people to update their sites. I'll make this a 2.1.0 version when it is released since it could be a breaking change. Well I guess you could say the current version is broken... hmm 🤔¯\_(ツ)_/¯
@ratanasdiabolo does this work for you?
Comment #11
ratanasdiabolo commentedThank you, I will test all this and I will come back to hear from you if it works ;)
Comment #12
ratanasdiabolo commentedI'm sorry I have the same error message...
------------------------------------------------
Le site Web a rencontré une erreur inattendue. Veuillez essayer de nouveau plus tard.
TypeError: abs(): Argument #1 ($num) must be of type int|float, string given in abs() (line 137 of core/includes/common.inc).
format_size() (Line: 156)
template_preprocess_file_upload_help()
call_user_func_array() (Line: 285)
Drupal\Core\Theme\ThemeManager->render() (Line: 445)
Drupal\Core\Render\Renderer->doRender() (Line: 204)
Drupal\Core\Render\Renderer->render() (Line: 148)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 592)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 149)
Drupal\Core\Render\Renderer->renderRoot() (Line: 70)
Drupal\file_resup\Form\FileFormAlterBase::managedFileProcess() (Line: 23)
Drupal\file_resup\Form\FileWidgetFormAlter::managedFileProcess()
call_user_func_array() (Line: 1012)
Drupal\Core\Form\FormBuilder->doBuildForm() (Line: 1075)
Drupal\Core\Form\FormBuilder->doBuildForm() (Line: 1075)
Drupal\Core\Form\FormBuilder->doBuildForm() (Line: 1075)
Drupal\Core\Form\FormBuilder->doBuildForm() (Line: 579)
Drupal\Core\Form\FormBuilder->processForm() (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 592)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 704)
Drupal\Core\DrupalKernel->handle() (Line: 19)
Merci d'avance.
Stéphen
Comment #13
tim bozeman commentedHmm, that's strange. Did you try re-saving the file size limits?
Comment #15
tostinni commentedI think the problem @ratanasdiabolo faced is that he was trying to put a value like "200 MB" but right now
max_upload_sizewill only accept integer.I added a commit to this MR to let user enter those kind of values and add a description too (same as core file max upload size)
The error message we had was slightly different but I think it's the same cause.
Btw @Tim Bozeman what is the reason between creating a new setting
max_upload_sizeinstead of reusingmax_filesize?Checking it, it doesn't limit its value to PHP
max_upload_sizeso you could already put a bigger value there although it wouldn't be applied without the override made by file_resup module.Should we kept only one field to avoid confusion ?
@ratanasdiabolo can you try with this MR ?
You can apply it to your
composer.jsonto the patches section:Comment #16
tim bozeman commentedThank you very much tostinni! That's a great question and I bet you're right and there are some simplifications to be made there. My thinking while porting it from D7 was that that duplication was present in the D7 version too. I wasn't certain why there was two, but figured there may have been a reason for having both. All I knew was that the D7 version has been battle tested and proven and I tried to change as little as possible in how it functioned.
Comment #18
s_leu commentedTrying this with a file that's approximately 14GB large, another issues surfaced. The
filesizecolumn is of typeintand may be too small for really large files, see attached screenshot. I pushed a change containing an update hook which will change the filesize basefield into a bigbigintDB column to tackle this.Comment #19
tim bozeman commentedThanks sebastian! How about when people just install file_resup? I think we need to set
biginton the field too. Also, there's a commented out update hook in the last commit 😅Comment #20
ricovandevin commentedAttaching patch file created from MR 11 for easier and safer Composer workflow.
Comment #21
ricovandevin commentedI did not review the code of the MR but the changes seem to resolve the issue with file size limit.
Comment #23
tim bozeman commentedWe've been using this for a while too. I think it's good to go! Thanks everybody!