You are here

protected function AActionUploadId::validateUploadId in N1ED - Visual editor as CKEditor plugin with Bootstrap support 8.2

Validates upload ID and throws exception in case of validation error.

4 calls to AActionUploadId::validateUploadId()
ActionUploadAddFile::run in src/Flmngr/FileUploaderServer/lib/action/ActionUploadAddFile.php
Runs action.
ActionUploadCancel::run in src/Flmngr/FileUploaderServer/lib/action/ActionUploadCancel.php
Runs action.
ActionUploadCommit::run in src/Flmngr/FileUploaderServer/lib/action/ActionUploadCommit.php
Runs action.
ActionUploadRemoveFile::run in src/Flmngr/FileUploaderServer/lib/action/ActionUploadRemoveFile.php
Runs action.

File

src/Flmngr/FileUploaderServer/lib/action/AActionUploadId.php, line 16

Class

AActionUploadId
Abstract class for all upload actions.

Namespace

Drupal\n1ed\Flmngr\FileUploaderServer\lib\action

Code

protected function validateUploadId($req) {
  if ($req->uploadId === NULL) {
    throw new MessageException(Message::createMessage(Message::UPLOAD_ID_NOT_SET));
  }
  $dir = $this->config
    ->getTmpDir() . DIRECTORY_SEPARATOR . $req->uploadId;
  if (!file_exists($dir) || !is_dir($dir)) {
    throw new MessageException(Message::createMessage(Message::UPLOAD_ID_INCORRECT));
  }
}