fileDownController.go 836 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * @Author: liling
  3. * @Date: 2022-08-13 14:38:13
  4. * @LastEditors: liling
  5. * @LastEditTime: 2022-08-13 14:38:15
  6. * @FilePath: \police_security\controllers\exelController.go
  7. * @Description:相关控制器
  8. *
  9. * Copyright (c) 2022 by liling/jujutong, All Rights Reserved.
  10. */
  11. package controllers
  12. //文件下载相关服务
  13. type FileDownController struct {
  14. BaseController
  15. }
  16. func init() {
  17. }
  18. //公用文件下载方法
  19. //可通过该方法实现对目标文件进行下载权限、过虑、记录等操作
  20. func (this *FileDownController) Get() {
  21. //图片,text,pdf文件全部在浏览器中显示了,并没有完全的实现下载的功能
  22. //this.Redirect("/static/img/1.jpg", 302)
  23. //第一个参数是文件的地址,第二个参数是下载显示的文件的名称
  24. this.Ctx.Output.Download("static/img/1.jpg", "tu1.jpg")
  25. }