Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func DownloadLicense(c *gin.Context) {
- content:="Download file here happliy"
- fileName := "hello.txt"
- c.Header("Content-Disposition", "attachment; filename="+fileName)
- c.Header("Content-Type", "application/text/plain")
- c.Header("Accept-Length", fmt.Sprintf("%d", len(content)))
- c.Writer.Write([]byte(content))
- c.JSON(http.StatusOK, gin.H{
- "msg": "Download file successfully",
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement