Пример #1
0
 /**
  * Generate download response
  *
  * @param Backup $backup
  * @return StreamedResponse
  */
 private function generateDownloadResponse(Backup $backup)
 {
     $response = new StreamedResponse(function () use($backup) {
         $backup->readStream();
     });
     $response->headers->set('Content-Type', 'application/zip');
     $contentDisposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $backup->disk_name);
     $response->headers->set('Content-Disposition', $contentDisposition);
     return $response;
 }