Esempio n. 1
0
 public function store(IFile $file)
 {
     if (is_null($file->getUID())) {
         $file->generateUID();
     }
     $data = ['id' => $file->getUID(), 'name' => $file->getName(), 'full_path' => $file->getFullPath(), 'size' => $file->getSize(), 'content_type' => $file->getContentType(), 'is_image' => $file->isImage()];
     return $this->context->table('media_storage')->insert($data);
 }
Esempio n. 2
0
 /**
  * @param IFile $file
  * @param $path
  * @return IFile
  */
 public function publishFile(IFile $file, $path)
 {
     $onlyPath = dirname($path);
     if (!file_exists($onlyPath)) {
         FilesystemStorage::mkdir($onlyPath, 0777, true);
     }
     $file->save($path);
     return $file;
 }