You are here

function FMDiskFileSystem::copyFiles in N1ED - Visual editor as CKEditor plugin with Bootstrap support 7

Overrides IFMDiskFileSystem::copyFiles

File

vendor/edsdk/flmngr-server-php/src/fs/FMDiskFileSystem.php, line 242

Class

FMDiskFileSystem

Namespace

EdSDK\FlmngrServer\fs

Code

function copyFiles($filesPaths, $newPath) {
  for ($i = 0; $i < count($filesPaths); $i++) {
    $fullPathSrc = $this
      ->getAbsolutePath($filesPaths[$i]);
    $index = strrpos($fullPathSrc, "/");
    $name = $index === FALSE ? $fullPathSrc : substr($fullPathSrc, $index + 1);
    $fullPathDst = $this
      ->getAbsolutePath($newPath) . "/" . $name;
    $res = copy($fullPathSrc, $fullPathDst);
    if ($res === FALSE) {
      throw new MessageException(FMMessage::createMessage(FMMessage::FM_ERROR_ON_COPYING_FILES));
    }
  }
}