more dependency injection!
This commit is contained in:
@@ -25,22 +25,25 @@ class Download extends Response {
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $name
|
||||
* @param array $headers
|
||||
* @return Response
|
||||
*/
|
||||
public function of($path, $name = null)
|
||||
public function of($path, $name = null, $headers = array())
|
||||
{
|
||||
if (is_null($name)) $name = basename($path);
|
||||
|
||||
$response = parent::__construct($this->file->get($path));
|
||||
$headers = array_merge(array(
|
||||
'Content-Description' => 'File Transfer',
|
||||
'Content-Type' => $this->mime($this->file->extension($path)),
|
||||
'Content-Disposition' => 'attachment; filename="'.$name.'"',
|
||||
'Content-Transfer-Encoding' => 'binary',
|
||||
'Expires' = => 0,
|
||||
'Cache-Control' => 'must-revalidate, post-check=0, pre-check=0',
|
||||
'Pragma' => 'public',
|
||||
'Content-Length' => $this->file-size($path),
|
||||
), $headers);
|
||||
|
||||
$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));
|
||||
$response = parent::__construct($this->file->get($path), 200, $headers);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user