Пример #1
0
 private function uploadFile($file)
 {
     $fullPath = $this->datadir . "/" . $this->fileAuthor . "/" . $this->localpath;
     $jpgBase64 = base64_encode(file_get_contents($this->dir . '/' . $file['filename']));
     $storage = new \OC\Files\Storage\Local(["datadir" => $fullPath]);
     $result = $storage->file_put_contents($file['filename'], base64_decode($jpgBase64));
     return ['storage' => $result, 'uploadpath' => $fullPath, 'path' => $this->localpath, 'filename' => $file['filename'], 'uid' => $this->fileAuthor];
 }
Пример #2
0
 private function saveFile($contents, $datadir, $author, $localpath, $filename)
 {
     $fullPath = $datadir . "/" . $author . "/" . $localpath;
     $jpgBase64 = base64_encode($contents);
     $storage = new \OC\Files\Storage\Local(["datadir" => $fullPath]);
     $result = $storage->file_put_contents($filename, base64_decode($jpgBase64));
     return ['storage' => $result, 'uploadpath' => $fullPath, 'path' => $localpath, 'filename' => $filename, 'uid' => $author];
 }
Пример #3
0
 public function testDisallowSymlinksInsideDatadir()
 {
     $subDir1 = $this->tmpDir . 'sub1';
     $subDir2 = $this->tmpDir . 'sub1/sub2';
     $sym = $this->tmpDir . 'sub1/sym';
     mkdir($subDir1);
     mkdir($subDir2);
     symlink($subDir2, $sym);
     $storage = new \OC\Files\Storage\Local(['datadir' => $subDir1]);
     $storage->file_put_contents('sym/foo', 'bar');
 }