private function setError(int $error)
{
switch ($error) {
case UPLOAD_ERR_PARTIAL:
$this->error = _('The uploaded file was only partially uploaded.');
break;
case UPLOAD_ERR_NO_FILE:
if ($this->requireUpload) {
$this->error = _('No file was uploaded.');
} else {
$this->failedEmpty = true;
}
break;
case UPLOAD_ERR_NO_TMP_DIR:
$this->error = _('Missing a temporary folder.');
break;
case UPLOAD_ERR_EXTENSION:
$this->error = _('File upload stopped by extension.');
break;
case UPLOAD_ERR_INI_SIZE:
case UPLOAD_ERR_FORM_SIZE:
$this->error = _('The file you are trying to upload is too big.');
break;
default:
$this->error = _('Unknown upload error.');
break;
}
}