diff --git a/workflow/engine/content/translations/english/processmaker.en.po b/workflow/engine/content/translations/english/processmaker.en.po index 98445aa1b..9a5944a7c 100644 --- a/workflow/engine/content/translations/english/processmaker.en.po +++ b/workflow/engine/content/translations/english/processmaker.en.po @@ -3436,8 +3436,8 @@ msgstr "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified # TRANSLATION # LABEL/ID_UPLOAD_ERR_INI_SIZE #: LABEL/ID_UPLOAD_ERR_INI_SIZE -msgid "The uploaded file exceeds the upload_max_filesize directive in php.ini" -msgstr "The uploaded file exceeds the upload_max_filesize directive in php.ini" +msgid "The uploaded file exceeds the upload_max_filesize or post_max_size directive in php.ini" +msgstr "The uploaded file exceeds the upload_max_filesize or post_max_size directive in php.ini" # TRANSLATION # LABEL/ID_NOT_PROCESS_RELATED diff --git a/workflow/engine/data/mssql/insert.sql b/workflow/engine/data/mssql/insert.sql index 4d1c8a24f..9cc6698b7 100755 --- a/workflow/engine/data/mssql/insert.sql +++ b/workflow/engine/data/mssql/insert.sql @@ -2562,7 +2562,7 @@ SELECT 'LABEL','ID_UPLOAD_ERR_PARTIAL','en','The uploaded file was only partiall UNION ALL SELECT 'LABEL','ID_UPLOAD_ERR_FORM_SIZE','en','The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form','2014-01-15' UNION ALL -SELECT 'LABEL','ID_UPLOAD_ERR_INI_SIZE','en','The uploaded file exceeds the upload_max_filesize directive in php.ini','2014-01-15' +SELECT 'LABEL','ID_UPLOAD_ERR_INI_SIZE','en','The uploaded file exceeds the upload_max_filesize or post_max_size directive in php.ini','2014-01-15' UNION ALL SELECT 'LABEL','ID_NOT_PROCESS_RELATED','en','Not from a Process','2014-01-15' UNION ALL diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index 249749d4d..3fe39567f 100644 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -1994,7 +1994,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_UPLOAD_ERR_NO_FILE','en','No file was uploaded','2014-01-15') , ( 'LABEL','ID_UPLOAD_ERR_PARTIAL','en','The uploaded file was only partially uploaded','2014-01-15') , ( 'LABEL','ID_UPLOAD_ERR_FORM_SIZE','en','The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form','2014-01-15') , -( 'LABEL','ID_UPLOAD_ERR_INI_SIZE','en','The uploaded file exceeds the upload_max_filesize directive in php.ini','2014-01-15') , +( 'LABEL','ID_UPLOAD_ERR_INI_SIZE','en','The uploaded file exceeds the upload_max_filesize or post_max_size directive in php.ini','2014-01-15') , ( 'LABEL','ID_NOT_PROCESS_RELATED','en','Not from a Process','2014-01-15') , ( 'LABEL','ID_EXTERNAL_FILE','en','External','2014-01-15') , ( 'LABEL','ID_INFO','en','Info','2014-01-15') , diff --git a/workflow/engine/methods/cases/cases_SaveData.php b/workflow/engine/methods/cases/cases_SaveData.php index 1cb1fc46e..a03868e07 100755 --- a/workflow/engine/methods/cases/cases_SaveData.php +++ b/workflow/engine/methods/cases/cases_SaveData.php @@ -60,6 +60,33 @@ if (!isset($_SESSION['USER_LOGGED'])) { '); } +/** + * If you can, you may want to set post_max_size to a low value (say 1M) to make + * testing easier. First test to see how your script behaves. Try uploading a file + * that is larger than post_max_size. If you do you will get a message like this + * in your error log: + * + * [09-Jun-2010 19:28:01] PHP Warning: POST Content-Length of 30980857 bytes exceeds + * the limit of 2097152 bytes in Unknown on line 0 + * + * This makes the script is not completed. + * + * Solving the problem: + * The PHP documentation http://php.net/manual/en/ini.core.php#ini.post-max-size + * provides a hack to solve this problem: + * + * If the size of post data is greater than post_max_size, the $_POST and $_FILES + * superglobals are empty. + */ +if ($_SERVER['REQUEST_METHOD'] == 'POST' && empty($_POST) && empty($_FILES) && $_SERVER['CONTENT_LENGTH'] > 0) { + $aMessage = array(); + $aMessage['MESSAGE'] = G::loadTranslation('ID_UPLOAD_ERR_INI_SIZE'); + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage); + G::RenderPage('publish', 'blank'); + die(); +} + try { if ($_GET['APP_UID'] !== $_SESSION['APPLICATION']) { throw new Exception( G::LoadTranslation( 'ID_INVALID_APPLICATION_ID_MSG', array ('{1}',G::LoadTranslation( 'ID_REOPEN' ) ) ) );