You are here

public function FileUploaded::checkForConflicts in N1ED - Visual editor as CKEditor plugin with Bootstrap support 7

File

vendor/edsdk/file-uploader-server-php/src/lib/file/FileUploaded.php, line 65

Class

FileUploaded

Namespace

EdSDK\FileUploaderServer\lib\file

Code

public function checkForConflicts($dir) {
  $this->m_confilictsErrors = [];
  $file = $this
    ->getCommitedFile($dir);
  if ($file
    ->exists()) {
    $this->m_confilictsErrors[] = Message::createMessage(Message::FILE_ALREADY_EXISTS, $file
      ->getName());
  }
  if ($file
    ->isImage()) {
    $fileOriginal = $file
      ->getFileOriginal();
    if ($fileOriginal
      ->exists()) {
      $this->m_confilictsErrors[] = Message::createMessage(Message::FILE_ALREADY_EXISTS, $fileOriginal
        ->getName());
    }
    $filePreview = $file
      ->getFilePreview();
    if ($filePreview
      ->exists()) {
      $this->m_confilictsErrors[] = Message::createMessage(Message::FILE_ALREADY_EXISTS, $filePreview
        ->getName());
    }
  }
}