If $this->blnHasError is set to true for Contao\DropZone during uploadTo(…) for example, there will simply be a 500 response and the error will not be visible in the DropZone. Instead it will show the following:
In this example I simulated a file with an invalid file name that would trigger
// Invalid file name
if (!\Validator::isValidFileName($file['name']))
{
\Message::addError($GLOBALS['TL_LANG']['ERR']['filename']);
$this->blnHasError = true;
}
within FileUpload::uploadTo. This can be fixed by adding
// Redirect or reload
if (!$objUploader->hasError())
{
if ($blnIsAjax)
{
throw new ResponseException(new Response(\Message::generateUnwrapped(), 201));
}
// Do not purge the html folder (see #2898)
if (isset($_POST['uploadNback']) && !$objUploader->hasResized())
{
\Message::reset();
$this->redirect($this->getReferer());
}
$this->reload();
}
+ elseif ($blnIsAjax)
+ {
+ throw new ResponseException(new Response(\Message::generateUnwrapped(), 500));
+ }
in DC_Folder::move. However, then it will still look like this:
Since the Message class automatically wraps the messages with HTML and DropZone expects the server response to be pure text.
If
$this->blnHasError
is set to true forContao\DropZone
duringuploadTo(…)
for example, there will simply be a500
response and the error will not be visible in the DropZone. Instead it will show the following:In this example I simulated a file with an invalid file name that would trigger
within
FileUpload::uploadTo
. This can be fixed by addingin
DC_Folder::move
. However, then it will still look like this:Since the
Message
class automatically wraps the messages with HTML and DropZone expects the server response to be pure text.