Download : Datei Download
(w http.ResponseWriter, r *http.Request)
| 1261 | |
| 1262 | // Download : Datei Download |
| 1263 | func Download(w http.ResponseWriter, r *http.Request) { |
| 1264 | |
| 1265 | var path = r.URL.Path |
| 1266 | var file = System.Folder.Temp + getFilenameFromPath(path) |
| 1267 | w.Header().Set("Content-Disposition", "attachment; filename="+getFilenameFromPath(file)) |
| 1268 | |
| 1269 | content, err := readStringFromFile(file) |
| 1270 | if err != nil { |
| 1271 | w.WriteHeader(404) |
| 1272 | return |
| 1273 | } |
| 1274 | |
| 1275 | os.RemoveAll(System.Folder.Temp + getFilenameFromPath(path)) |
| 1276 | w.Write([]byte(content)) |
| 1277 | return |
| 1278 | } |
| 1279 | |
| 1280 | func setDefaultResponseData(response ResponseStruct, data bool) (defaults ResponseStruct) { |
| 1281 |
nothing calls this directly
no test coverage detected