Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
b45f0b9b
authored
2014-05-17 02:56:50 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
beego: fix #478
1 parent
cf04ade6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletions
context/output.go
context/output.go
View file @
b45f0b9
...
...
@@ -237,10 +237,14 @@ func (output *BeegoOutput) Xml(data interface{}, hasIndent bool) error {
// Download forces response for download file.
// it prepares the download response header automatically.
func
(
output
*
BeegoOutput
)
Download
(
file
string
)
{
func
(
output
*
BeegoOutput
)
Download
(
file
string
,
filename
...
string
)
{
output
.
Header
(
"Content-Description"
,
"File Transfer"
)
output
.
Header
(
"Content-Type"
,
"application/octet-stream"
)
if
len
(
filename
)
>
0
&&
filename
[
0
]
!=
""
{
output
.
Header
(
"Content-Disposition"
,
"attachment; filename="
+
filename
[
0
])
}
else
{
output
.
Header
(
"Content-Disposition"
,
"attachment; filename="
+
filepath
.
Base
(
file
))
}
output
.
Header
(
"Content-Transfer-Encoding"
,
"binary"
)
output
.
Header
(
"Expires"
,
"0"
)
output
.
Header
(
"Cache-Control"
,
"must-revalidate"
)
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment