Show more helpful error message if destination is not specified in a file field

This commit is contained in:
Flavio Copes
2016-10-10 13:07:34 +02:00
parent ef063f0e7d
commit fd426b4d49
2 changed files with 10 additions and 0 deletions

View File

@@ -1652,6 +1652,15 @@ class AdminController
$upload = $this->normalizeFiles($_FILES['data'], $settings->name);
if (!isset($settings->destination)) {
$this->admin->json_response = [
'status' => 'error',
'message' => $this->admin->translate('PLUGIN_ADMIN.DESTINATION_NOT_SPECIFIED', null, true)
];
return false;
}
// Do not use self@ outside of pages
if ($this->view != 'pages' && in_array($settings->destination, ['@self', 'self@'])) {
$this->admin->json_response = [

View File

@@ -612,4 +612,5 @@ PLUGIN_ADMIN:
DROPZONE_RESPONSE_ERROR: "Server responded with {{statusCode}} code."
ADMIN_CACHING: "Enable Admin Caching"
ADMIN_CACHING_HELP: "Caching in the admin can be controlled independently from the front-end site"
DESTINATION_NOT_SPECIFIED: "Destination not specified"
UPLOAD_ERR_NO_TMP_DIR: "Missing a temporary folder"