diff --git a/main/newscorm/lp_upload.php b/main/newscorm/lp_upload.php index be8fb7eb58..0ac0efc998 100644 --- a/main/newscorm/lp_upload.php +++ b/main/newscorm/lp_upload.php @@ -27,7 +27,13 @@ $uncompress = 1; * size set in php.ini, all variables from POST are cleared ! */ -if ($_SERVER['REQUEST_METHOD'] == 'POST' && count($_FILES) > 0 && !empty($_FILES['user_file']['name'])) { +$user_file = Request::is_post() ? Request::file('user_file') : array(); +$user_file = $user_file ? $user_file : array(); +$is_error = isset($user_file['error']) ? $user_file['error'] : false; +if( Request::is_post() && $is_error){ + return api_failure::set_failure('upload_file_too_big'); + unset($_FILEs['user_file']); +}else if ($_SERVER['REQUEST_METHOD'] == 'POST' && count($_FILES) > 0 && !empty($_FILES['user_file']['name'])) { // A file upload has been detected, now deal with the file... diff --git a/main/upload/upload.scorm.php b/main/upload/upload.scorm.php index de347797bd..a5bc6ba2d5 100644 --- a/main/upload/upload.scorm.php +++ b/main/upload/upload.scorm.php @@ -18,7 +18,10 @@ chdir($cwdir); $error = api_failure::get_last_failure(); -if ($error=='not_a_learning_path') { +if ($error == 'upload_file_too_big'){ + $msg = urlencode(get_lang('UplFileTooBig')); + $dialogtype = 'error'; +}else if ($error=='not_a_learning_path') { $msg = urlencode(get_lang('ScormUnknownPackageFormat')); $dialogtype = 'error'; } elseif ($error == 'not_enough_space') {