mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-02-18 20:47:48 +01:00
Handle empty files due to upload_max_filesize
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
* Improved image background overlay and tools
|
||||
* Update all Form classes to rely on `PageInterface` instead of `Page` class
|
||||
* Removed `media.upload_limit` references
|
||||
* Improve error when upload exceeds `upload_max_filesize`
|
||||
1. [](#bugfix)
|
||||
* Incorrect 2FA lang code [#1618](https://github.com/getgrav/grav-plugin-admin/issues/1618)
|
||||
* Fixed potential undefined property in `onPageNotFound` event handling
|
||||
|
||||
@@ -1567,6 +1567,15 @@ class AdminController extends AdminBaseController
|
||||
/** @var Config $config */
|
||||
$config = $this->grav['config'];
|
||||
|
||||
if (!isset($_FILES) || empty($_FILES)) {
|
||||
$this->admin->json_response = [
|
||||
'status' => 'error',
|
||||
'message' => $this->admin::translate('PLUGIN_ADMIN.EXCEEDED_POSTMAX_LIMIT')
|
||||
];
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isset($_FILES['file']['error']) || is_array($_FILES['file']['error'])) {
|
||||
$this->admin->json_response = [
|
||||
'status' => 'error',
|
||||
|
||||
@@ -178,7 +178,8 @@ PLUGIN_ADMIN:
|
||||
NO_PAGE_FOUND: "No Page found"
|
||||
INVALID_PARAMETERS: "Invalid Parameters"
|
||||
NO_FILES_SENT: "No files sent"
|
||||
EXCEEDED_FILESIZE_LIMIT: "Exceeded PHP configuration file size limit"
|
||||
EXCEEDED_FILESIZE_LIMIT: "Exceeded PHP configuration upload_max_filesize"
|
||||
EXCEEDED_POSTMAX_LIMIT: "Exceeded PHP configuration post_max_size"
|
||||
UNKNOWN_ERRORS: "Unknown errors"
|
||||
EXCEEDED_GRAV_FILESIZE_LIMIT: "Exceeded Grav configuration file size limit"
|
||||
UNSUPPORTED_FILE_TYPE: "Unsupported file type"
|
||||
|
||||
Reference in New Issue
Block a user