@@ -42,9 +42,10 @@ public function response(Result $result = null)
42
42
Hash::get ($ data , 'filesystem ' ),
43
43
Hash::get ($ data , 'path ' )
44
44
);
45
+ $ name = Hash::get ($ data , 'name ' );
45
46
46
47
$ this ->_service ->setResponse (
47
- $ this ->deliverAsset ($ this ->_service ->getResponse (), $ file )
48
+ $ this ->deliverAsset ($ this ->_service ->getResponse (), $ file, $ name )
48
49
);
49
50
} catch (FileNotFoundException $ e ) {
50
51
$ response = $ this ->_service ->getResponse ()
@@ -73,9 +74,10 @@ protected function getFile(Filesystem $filesystem, $path)
73
74
*
74
75
* @param Response $response service response
75
76
* @param File $file file object
77
+ * @param string $name file name shown to user
76
78
* @return Response
77
79
*/
78
- public function deliverAsset (Response $ response , File $ file )
80
+ public function deliverAsset (Response $ response , File $ file, $ name )
79
81
{
80
82
$ contentType = $ file ->getType ();
81
83
$ modified = $ file ->getTimestamp ();
@@ -86,6 +88,8 @@ public function deliverAsset(Response $response, File $file)
86
88
return $ response ->withBody ($ stream )
87
89
// Content
88
90
->withHeader ('Content-Type ' , $ contentType )
91
+ //Name
92
+ ->withDownload ($ name )
89
93
// Cache
90
94
->withHeader ('Cache-Control ' , 'public,max-age= ' . $ maxAge )
91
95
->withHeader ('Date ' , gmdate ('D, j M Y G:i:s \G\M\T ' , time ()))
0 commit comments