如何在PHPCR中存储和检索PDF文件?
我使用ApacheJackrabbit服务器作为WebDAV服务器作为应用程序的文件存储后端。该应用程序是使用PHP开发的。我想存储一个PDF文件,并使用PHP内容存储库从jackrabbit服务器检索回来 有人能帮我吗 下面给出了使用的示例代码, 用于存储:如何在PHPCR中存储和检索PDF文件?,php,webdav,jackrabbit,doctrine-phpcr,content-repository,Php,Webdav,Jackrabbit,Doctrine Phpcr,Content Repository,我使用ApacheJackrabbit服务器作为WebDAV服务器作为应用程序的文件存储后端。该应用程序是使用PHP开发的。我想存储一个PDF文件,并使用PHP内容存储库从jackrabbit服务器检索回来 有人能帮我吗 下面给出了使用的示例代码, 用于存储: $session = $this->getjackrabbitSession(); $node = $session->getNode('/project/files/test.pdf'); $contents = file_
$session = $this->getjackrabbitSession();
$node = $session->getNode('/project/files/test.pdf');
$contents = file_get_contents($fileURL);
$node->setProperty("nt:file", $contents);
$node->setProperty("mimeType", 'application/pdf');
$node->setProperty("fileName", 'test.pdf');
$session->save();
用于检索:
$session = $this->getjackrabbitSession();
$node = $session->getNode('/project/files/test.pdf');
$contents = $node->getContent();
$mimeType = $node->getPropertyValue('mimeType');
$fileName = $node->getPropertyValue('fileName');