1
0
mirror of https://github.com/labstack/echo.git synced 2025-06-06 23:46:16 +02:00
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2015-10-16 07:51:42 -07:00
parent 9ea3463d2c
commit 2cca641ffb

View File

@ -4,7 +4,7 @@ import (
"encoding/json" "encoding/json"
"encoding/xml" "encoding/xml"
"net/http" "net/http"
spath "path" "path/filepath"
"fmt" "fmt"
@ -198,7 +198,7 @@ func (c *Context) XML(code int, i interface{}) (err error) {
// to true, the client is prompted to save the file with provided `name`, // to true, the client is prompted to save the file with provided `name`,
// name can be empty, in that case name of the file is used. // name can be empty, in that case name of the file is used.
func (c *Context) File(path, name string, attachment bool) (err error) { func (c *Context) File(path, name string, attachment bool) (err error) {
dir, file := spath.Split(path) dir, file := filepath.Split(path)
if attachment { if attachment {
c.response.Header().Set(ContentDisposition, "attachment; filename="+name) c.response.Header().Set(ContentDisposition, "attachment; filename="+name)
} }