Closed badstorm closed 5 years ago
you can use:
func DownloadGet(c buffalo.Context) error {
...
yourFileData := []byte{...}
c.Response().Header().Set("Content-Disposition", "attachment;filename=<YOUR_FILE_NAME>")
_, err = c.Response().Write(yourFileData)
return err
}
Thanks, that was just what I was looking for.
Description
I need to return a file, that must before been elaborate, from an action. My solution works but there is no file size info ore a custum name.
Steps to Reproduce the Problem
My code has a function that generate a zip file and then an action to return the zip:
Expected Behavior
When i get the browser download popup it should show a custom name, like "02082019.zip" and the full size of the file so when the browser download it show the progress bar.
Actual Behavior
Using the code above, the file name is "get" and there is no size info so the browser show only the current downloaded bytes.
Info