You are here

protected function Upload::savefileToDrupal in UEditor - 百度编辑器 8

上传保存文件到drupal

Parameters

$imagedata:

$savePath:

Return value

string

3 calls to Upload::savefileToDrupal()
UploadCatch::doUpload in src/Uploader/UploadCatch.php
UploadFile::doUpload in src/Uploader/UploadFile.php
UploadScrawl::doUpload in src/Uploader/UploadScrawl.php

File

src/Uploader/Upload.php, line 80

Class

Upload
UEditor编辑器通用上传类

Namespace

Drupal\ueditor\Uploader

Code

protected function savefileToDrupal($imagedata, $savePath, $managed = FALSE, $replace = FileSystemInterface::EXISTS_RENAME) {
  if ($managed) {
    $local = file_save_data($imagedata, 'public://' . $savePath, $replace);
  }
  else {
    try {
      $local = \Drupal::service('file_system')
        ->saveData($imagedata, 'public://' . $savePath, $replace);
    } catch (\Drupal\Core\File\Exception\FileException $e) {

      // Log or set message or doing something else.
    }
  }
  return $local;
}