Ejemplo n.º 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;
 }
 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;
 }