file = $file; } /** * Create a new download response instance. * * @param string $path * @param string $name * @return Response */ public function of($path, $name = null) { if (is_null($name)) $name = basename($path); $response = parent::__construct($this->file->get($path)); $response->header('Content-Description', 'File Transfer'); $response->header('Content-Type', $this->file->mime($this->file->extension($path))); $response->header('Content-Disposition', 'attachment; filename="'.$name.'"'); $response->header('Content-Transfer-Encoding', 'binary'); $response->header('Expires', 0); $response->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0'); $response->header('Pragma', 'public'); $response->header('Content-Length', $this->file->size($path)); return $response; } }