コード例 #1
0
 public function RenderAction(\SW\DocManagerBundle\Entity\Document $document)
 {
     $path = $document->getPath();
     $response = new BinaryFileResponse($path);
     $response->trustXSendfileTypeHeader();
     $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_INLINE, $document->getName());
     return $response;
 }
コード例 #2
0
 protected function renameFile(Document $document, $newname)
 {
     $file = new File($document->getPath());
     if (null === $file) {
         return;
     }
     $file->move($this->getUploadRootDir(), $newname);
     $document->setName($newname);
     $document->setPath($this->getUploadRootDir() . '/' . $newname);
     return $document;
 }