mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 07:50:54 +00:00
improve the download func code
This commit is contained in:
parent
a9ffc2a078
commit
1c893996c0
@ -291,7 +291,7 @@ func (output *BeegoOutput) Download(file string, filename ...string) {
|
|||||||
//https://tools.ietf.org/html/rfc6266#section-4.3
|
//https://tools.ietf.org/html/rfc6266#section-4.3
|
||||||
fn := url.PathEscape(fName)
|
fn := url.PathEscape(fName)
|
||||||
if fName == fn {
|
if fName == fn {
|
||||||
output.Header("Content-Disposition", "attachment; filename="+fn)
|
fn = "filename=" + fn
|
||||||
} else {
|
} else {
|
||||||
/**
|
/**
|
||||||
The parameters "filename" and "filename*" differ only in that
|
The parameters "filename" and "filename*" differ only in that
|
||||||
@ -299,8 +299,9 @@ func (output *BeegoOutput) Download(file string, filename ...string) {
|
|||||||
of characters not present in the ISO-8859-1 character set
|
of characters not present in the ISO-8859-1 character set
|
||||||
([ISO-8859-1]).
|
([ISO-8859-1]).
|
||||||
*/
|
*/
|
||||||
output.Header("Content-Disposition", "attachment; filename*=utf-8''"+fn)
|
fn = "filename=" + fName + "; filename*=utf-8''" + fn
|
||||||
}
|
}
|
||||||
|
output.Header("Content-Disposition", "attachment; "+fn)
|
||||||
output.Header("Content-Description", "File Transfer")
|
output.Header("Content-Description", "File Transfer")
|
||||||
output.Header("Content-Type", "application/octet-stream")
|
output.Header("Content-Type", "application/octet-stream")
|
||||||
output.Header("Content-Transfer-Encoding", "binary")
|
output.Header("Content-Transfer-Encoding", "binary")
|
||||||
|
Loading…
Reference in New Issue
Block a user