Error caught when Uploading file larger than 100KB

image

Caught this when uploading files greater than 100kb. Tried some file that 117kb in size works. but larger than that Getting this error.

Hope I can get some idea or help regarding this issue.

P.S.
I already configured php.ini (max file size, etc) and also in application/config/grocerycrud.php (upload_max_file_size)

Thank you all

Hello @entrylvlSE and welcome to our forums :grinning:

Usually the issue that you can’t see the error message is that the error reporting is not showing the error message. In order to see the error try for debugging the following instructions: How do I get PHP errors to display? - Stack Overflow

Now for your specific issue since the default value oh php.ini for upload_max_file_size is 100KB I don’t think that this is a coincidence. Please try to restart Apache to apply the changes. If this is still not working then maybe the php.ini file is on different folder.

Try creating a file with name phpinfo.php and add the following lines:

<?php
phpinfo(); 

This will print the configurations of PHP that you are using. Search for php.ini and you will see the location of your php.ini file as you can also see at the screenshot:

Please let me know if that worked for you.

Regards
Johnny

1 Like

Sir Johnny, Thank you for your response

Thats my php information.

Is it correct that the conf file is diff from loaded conf file?

And also the PHP Error configuration is already set. yet no error are showing.

Thank you Sir

Hello @entrylvlSE yes that’s correct the C:\php\php.ini file is the file that you should change. Also make sure that you’ve also restarted Apache or else the changes will not be applied.

Last but not least it seems that you are using PHP version 5.6.30 which we silently not support. I would suggest you to upgrade to PHP version 7 or later (if possible) as you may experience other issues with the library as well.

Regards
Johnny

1 Like

Good Day Sir @johnny,

I already edited that file but same error occurs.

We are already in process of upgrading our PHP version.

Thank you for your quick and vast response.

Thank you!

Good day Sir Johnny

What is your recommended version to properly use GCRUD Latest Version
php v?
Codeigniter v?

Thank you

Hello @entrylvlSE ,

I would suggest latest Codeigniter version and latest PHP version if possible:

Codeigniter v4.2.10
PHP version v8.1

Regards
Johnny

1 Like

Thank you Sir Johnny.

I will consider your suggestion.

But I’m still confused why I’m encountering that kind of error when uploading. Hope I can still get some answers.

Thank you Sir Johnny.

Hello @entrylvlSE ,

Back to your problem. From my experience when there are some upload limitations then the error is not reported from PHP (e.g. it can’t handle it and it is showing a blank page). I strongly believe that the issue is still that the configuration is not updated. Can you attach the screenshot of phpinfo by searching upload_max_filesize as you can also see at the below screenshot?

Also so I can help more, what Codeigniter version are you using?

Regards
Johnny

1 Like

Thank you Sir for responding.

I am currently using Codeigniter 3.1.4.
GCRUD Version 2.7.9

image

Hello @entrylvlSE ,

Can you also check few more configurations?

max_execution_time, max_file_uploads, max_input_time, output_buffering, memory_limit, post_max_size

Also screenshot for the info:

If this is still doesn’t work then I am not convinced that it picked up the correct configuration still :grinning:. Can you open the page with the enterprise version and instead of loading the CRUD (e.g. $crud->setTable()… e.t.c.) to output the below code and let me know the output please?

var_dump(ini_get('upload_max_filesize'));
exit;

and see if this is corresponding the correct value for you? My blind guess would be that you have 2 PHP installed into your machine. If this is the case you will need to find the second php.ini file and do the change there as well.

Regards
Johnny

1 Like

Good Day Sir Johnny.

Thank you again for your fast response and will to help me out of this problem.

This is what I got from running the code. Its the same from the configuration.

That’s very weird then. The only thing that you can do here is to debug it a little bit if this is not a big issue for you. Go to the file: application/libraries/GroceryCrudEnterprise/grocerycrud/enterprise/src/GroceryCrud/Core/State/UploadState.php and start debugging it to see where the issue is. More specifically go to the line 26 and start adding some var_dump . For example:

public function render()
    {
        var_dump('hello');
        die;
        $stateParameters = $this->getStateParameters();

        $this->setModel();
        $model = $this->gCrud->getModel();

        $this->initializeLight($model);

If this will work try to move the:

        var_dump('hello');
        die;

to a lower line to see where the issue is. My blind guess will be that this is not even going to the “render” function and PHP is blocking it.