Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
47655843
Commit
47655843
authored
Jun 10, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjusted parameter order.
parent
ad218c67
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
Response.php
framework/yii/web/Response.php
+8
-8
No files found.
framework/yii/web/Response.php
View file @
47655843
...
...
@@ -277,10 +277,10 @@ class Response extends \yii\base\Response
/**
* Sends a file to the browser.
* @param string $filePath the path of the file to be sent.
* @param string $mimeType the MIME type of the content. If null, it will be guessed based on `$filePath`
* @param string $attachmentName the file name shown to the user. If null, it will be determined from `$filePath`.
* @param string $mimeType the MIME type of the content. If null, it will be guessed based on `$filePath`
*/
public
function
sendFile
(
$filePath
,
$
mimeType
=
null
,
$attachmentNam
e
=
null
)
public
function
sendFile
(
$filePath
,
$
attachmentName
=
null
,
$mimeTyp
e
=
null
)
{
if
(
$mimeType
===
null
&&
(
$mimeType
=
FileHelper
::
getMimeTypeByExtension
(
$filePath
))
===
null
)
{
$mimeType
=
'application/octet-stream'
;
...
...
@@ -289,16 +289,16 @@ class Response extends \yii\base\Response
$attachmentName
=
basename
(
$filePath
);
}
$handle
=
fopen
(
$filePath
,
'rb'
);
$this
->
sendStreamAsFile
(
$handle
,
$
mimeType
,
$attachmentNam
e
);
$this
->
sendStreamAsFile
(
$handle
,
$
attachmentName
,
$mimeTyp
e
);
}
/**
* Sends the specified content as a file to the browser.
* @param string $content the content to be sent. The existing [[content]] will be discarded.
* @param string $mimeType the MIME type of the content.
* @param string $attachmentName the file name shown to the user.
* @param string $mimeType the MIME type of the content.
*/
public
function
sendContentAsFile
(
$content
,
$
mimeType
=
'application/octet-stream'
,
$attachmentName
=
'file
'
)
public
function
sendContentAsFile
(
$content
,
$
attachmentName
=
'file'
,
$mimeType
=
'application/octet-stream
'
)
{
$this
->
getHeaders
()
->
addDefault
(
'Pragma'
,
'public'
)
...
...
@@ -317,11 +317,11 @@ class Response extends \yii\base\Response
/**
* Sends the specified stream as a file to the browser.
* @param resource $handle the handle of the stream to be sent.
* @param string $mimeType the MIME type of the stream content.
* @param string $attachmentName the file name shown to the user.
* @param string $mimeType the MIME type of the stream content.
* @throws HttpException if the requested range cannot be satisfied.
*/
public
function
sendStreamAsFile
(
$handle
,
$
mimeType
=
'application/octet-stream'
,
$attachmentName
=
'file
'
)
public
function
sendStreamAsFile
(
$handle
,
$
attachmentName
=
'file'
,
$mimeType
=
'application/octet-stream
'
)
{
$headers
=
$this
->
getHeaders
();
fseek
(
$handle
,
0
,
SEEK_END
);
...
...
@@ -455,7 +455,7 @@ class Response extends \yii\base\Response
* @param string $attachmentName file name shown to the user. If null, it will be determined from `$filePath`.
* @param string $xHeader the name of the x-sendfile header.
*/
public
function
xSendFile
(
$filePath
,
$
mimeType
=
null
,
$attachmentNam
e
=
null
,
$xHeader
=
'X-Sendfile'
)
public
function
xSendFile
(
$filePath
,
$
attachmentName
=
null
,
$mimeTyp
e
=
null
,
$xHeader
=
'X-Sendfile'
)
{
if
(
$mimeType
===
null
&&
(
$mimeType
=
FileHelper
::
getMimeTypeByExtension
(
$filePath
))
===
null
)
{
$mimeType
=
'application/octet-stream'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment