Pimcore\Model\Asset\WebDAV\File::put PHP 메소드

put() 공개 메소드

public put ( resource $data )
$data resource
    public function put($data)
    {
        if ($this->asset->isAllowed("publish")) {
            // read from resource -> default for SabreDAV
            $tmpFile = PIMCORE_SYSTEM_TEMP_DIRECTORY . "/asset-dav-tmp-file-" . uniqid();
            file_put_contents($tmpFile, $data);
            $file = fopen($tmpFile, "r+", false, FileHelper::getContext());
            $user = AdminTool::getCurrentUser();
            $this->asset->setUserModification($user->getId());
            $this->asset->setStream($file);
            $this->asset->save();
            fclose($file);
            unlink($tmpFile);
        } else {
            throw new DAV\Exception\Forbidden();
        }
    }