change max file upload size without generating a new application

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
User avatar
D Oliveira
AppGini Super Hero
AppGini Super Hero
Posts: 347
Joined: 2018-03-04 09:30
Location: David

change max file upload size without generating a new application

Post by D Oliveira » 2019-03-29 14:30

good morning, how to change max file upload size of a field without generating a new application ? my server is up to 20 mb but appgini is restricting to 10 mb, if I upload a new application it will overwrite custom code and that would be a hassle to update, isnt there just a file I can access to change that config?

Thank you

User avatar
D Oliveira
AppGini Super Hero
AppGini Super Hero
Posts: 347
Joined: 2018-03-04 09:30
Location: David

Re: change max file upload size without generating a new application

Post by D Oliveira » 2019-03-29 14:37

nevermind, started messing around and found tablename_dml.php , make sure to replace all references to the max size and you should be good to go.

thanks

sathukorala
AppGini Super Hero
AppGini Super Hero
Posts: 121
Joined: 2020-02-16 16:29

Re: change max file upload size without generating a new application

Post by sathukorala » 2020-07-28 11:16

D Oliveira wrote:
2019-03-29 14:37
nevermind, started messing around and found tablename_dml.php , make sure to replace all references to the max size and you should be good to go.

thanks
What are the other references?
I couldn't do it by just changing the tablename_dml.php

User avatar
D Oliveira
AppGini Super Hero
AppGini Super Hero
Posts: 347
Joined: 2018-03-04 09:30
Location: David

Re: change max file upload size without generating a new application

Post by D Oliveira » 2020-07-28 23:08

sathukorala wrote:
2020-07-28 11:16
D Oliveira wrote:
2019-03-29 14:37
nevermind, started messing around and found tablename_dml.php , make sure to replace all references to the max size and you should be good to go.

thanks
What are the other references?
I couldn't do it by just changing the tablename_dml.php
something like:

Code: Select all

$templateCode = str_replace('<%%UPLOADFILE(thumb)%%>', ($noUploads ? '' : "<div>{$Translation['upload image']}</div>" . '<i class="glyphicon glyphicon-remove text-danger clear-upload hidden"></i> <input type="file" name="thumb" id="thumb" data-filetypes="jpg|jpeg|gif|png" data-maxsize="10240000">'), $templateCode);

sathukorala
AppGini Super Hero
AppGini Super Hero
Posts: 121
Joined: 2020-02-16 16:29

Re: change max file upload size without generating a new application

Post by sathukorala » 2020-07-29 12:21

D Oliveira wrote:
2020-07-28 23:08
sathukorala wrote:
2020-07-28 11:16
D Oliveira wrote:
2019-03-29 14:37
nevermind, started messing around and found tablename_dml.php , make sure to replace all references to the max size and you should be good to go.

thanks
What are the other references?
I couldn't do it by just changing the tablename_dml.php
something like:

Code: Select all

$templateCode = str_replace('<%%UPLOADFILE(thumb)%%>', ($noUploads ? '' : "<div>{$Translation['upload image']}</div>" . '<i class="glyphicon glyphicon-remove text-danger clear-upload hidden"></i> <input type="file" name="thumb" id="thumb" data-filetypes="jpg|jpeg|gif|png" data-maxsize="10240000">'), $templateCode);
Yes I have changed that. But it seems it's not enough. I tried inCommon.php also but more dependencies are there.

sathukorala
AppGini Super Hero
AppGini Super Hero
Posts: 121
Joined: 2020-02-16 16:29

Re: change max file upload size without generating a new application

Post by sathukorala » 2020-07-29 12:44

D Oliveira wrote:
2020-07-28 23:08
sathukorala wrote:
2020-07-28 11:16
D Oliveira wrote:
2019-03-29 14:37
nevermind, started messing around and found tablename_dml.php , make sure to replace all references to the max size and you should be good to go.

thanks
What are the other references?
I couldn't do it by just changing the tablename_dml.php
something like:

Code: Select all

$templateCode = str_replace('<%%UPLOADFILE(thumb)%%>', ($noUploads ? '' : "<div>{$Translation['upload image']}</div>" . '<i class="glyphicon glyphicon-remove text-danger clear-upload hidden"></i> <input type="file" name="thumb" id="thumb" data-filetypes="jpg|jpeg|gif|png" data-maxsize="10240000">'), $templateCode);

This line still works
$Translation['file too large']="Error: The file you uploaded exceeds the maximum allowed size of <MaxSize> KB";

<MaxSize> is stored somewhere else. Can Ahmed help us?

sathukorala
AppGini Super Hero
AppGini Super Hero
Posts: 121
Joined: 2020-02-16 16:29

Re: change max file upload size without generating a new application

Post by sathukorala » 2020-07-29 23:34

There are other two places where the table_dml.php has this file size by the following format:

Code: Select all

$data['fields_name'] = PrepareUploadedFile('field_name', 10240000,'jpg|jpeg|gif|png', false, '');
Yet after changing that still the error occurs?

sathukorala
AppGini Super Hero
AppGini Super Hero
Posts: 121
Joined: 2020-02-16 16:29

Re: change max file upload size without generating a new application

Post by sathukorala » 2020-07-31 11:27

At last find the solution. Jan Setzer helped a lot to find it.
You have to change below lines.

1. common.js.php

Code: Select all

if(!AppGini.checkFileUpload('field_name', 'jpg|jpeg|gif|png', 10240000)) return false;
2. templates > Tablename_templateDV.html

Code: Select all

<span class="help-block collapse" id="field_name-description"><div class="alert alert-info">Maximum file size allowed: 10000 KB.<br>Allowed file types: jpg, jpeg, gif, png</div></span>
3. Tablename_dml.php

Code: Select all

$data['field_name'] = PrepareUploadedFile('field_name', 1024000, 'jpg|jpeg|gif|png', false, "");

$templateCode = str_replace('<%%UPLOADFILE(field_name)%%>', ($noUploads ? '' : "<div>{$Translation['upload file']}</div>" . '<i class="glyphicon glyphicon-remove text-danger clear-upload hidden"></i> <input type="file" name="field_name" id="field_name" data-filetypes="jpg|jpeg|gif|png" data-maxsize="10240000">'), $templateCode);
You have to change the php.ini in Apache server too
Use a standard text editor to open /etc/php/apache2/php.ini, search for the following variables and change/increase these to:

memory_limit = 512M
upload_max_filesize = 15M
post_max_size = 100M

Some more values to change if you want a better performance of your web server:

max_execution_time = 600
max_input_time = 600
memory_limit = 1024M

Save and close the editor/file and restart the apache web server with:

service apache2 restart
or
systemctl restart apache2

Post Reply