From 7e33af66771113ea337db39bfb5a696f3c9311bd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Nov 2018 17:40:59 +0100 Subject: [PATCH] Fix max size --- htdocs/admin/modules.php | 24 ++++++++++++++++++++++- htdocs/core/class/html.formfile.class.php | 1 + 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 68f7c3a29a7..ae87a19e433 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -40,6 +40,7 @@ $langs->loadLangs(array("errors","admin","modulebuilder")); $mode=GETPOST('mode', 'alpha'); if (empty($mode)) $mode='common'; $action=GETPOST('action','alpha'); +//var_dump($_POST);exit; $value=GETPOST('value', 'alpha'); $page_y=GETPOST('page_y','int'); $search_keyword=GETPOST('search_keyword','alpha'); @@ -1003,8 +1004,29 @@ if ($mode == 'deploy') print '
'; print ''; print ''; - print $langs->trans("YouCanSubmitFile").' '; + + print $langs->trans("YouCanSubmitFile"); + + $max=$conf->global->MAIN_UPLOAD_DOC; // En Kb + $maxphp=@ini_get('upload_max_filesize'); // En inconnu + if (preg_match('/k$/i',$maxphp)) $maxphp=$maxphp*1; + if (preg_match('/m$/i',$maxphp)) $maxphp=$maxphp*1024; + if (preg_match('/g$/i',$maxphp)) $maxphp=$maxphp*1024*1024; + if (preg_match('/t$/i',$maxphp)) $maxphp=$maxphp*1024*1024*1024; + // Now $max and $maxphp are in Kb + $maxmin = $max; + if ($maxphp > 0) $maxmin=min($max,$maxphp); + + if ($maxmin > 0) + { + // MAX_FILE_SIZE doit précéder le champ input de type file + print ''; + } + + print ' '; + print ''; + print '
'; print '
'; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 7a0c07bb996..4e77269db4c 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -127,6 +127,7 @@ class FormFile if ($maxmin > 0) { + // MAX_FILE_SIZE doit précéder le champ input de type file $out .= ''; }