gin实现文件下载

1
2
3
4
5
func FileDownload(c *gin.Context){
    //c.Writer.Header().Add("Content-Disposition", fmt.Sprintf("attachment; filename=%s", "test"))//fmt.Sprintf("attachment; filename=%s", filename)对下载的文件重命名
    //c.Writer.Header().Add("Content-Type", "application/octet-stream")
    c.File("F:/go/demo/employ/files/5cdc28916a707.doc")
}

  

posted @   ☞@_@  阅读(1036)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· 单线程的Redis速度为什么快?
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
点击右上角即可分享
微信分享提示