download_file_controller.go 334 字节
package controllers

import (
	"github.com/linmadan/egglib-go/web/beego"
	"path/filepath"
)

type DownloadFileController struct {
	beego.BaseController
}

func (controller *DownloadFileController) DownloadHandle() {
	filename := filepath.Base(controller.GetString(":filename"))
	controller.Ctx.Output.Download("public/" + filename)
}