fix files uploading

This commit is contained in:
cyber-dream 2023-05-03 22:50:43 +03:00
parent 7e65712103
commit 0ae5eb4325

View File

@ -90,6 +90,9 @@ func main() {
}
// single file
file, _ := ctx.FormFile("file")
if file == nil {
ctx.String(http.StatusBadRequest, "file is nil")
}
// generateMins := c.Param("generateMins")
// log.Println(file.Filename)
@ -127,8 +130,9 @@ func main() {
if err != nil {
ctx.String(http.StatusInternalServerError, "TODO") //TODO
}
data := file.Data.(primitive.Binary)
ctx.Data(200, "image/jpeg", file.Data.(primitive.Binary).Data)
ctx.Data(http.StatusOK, "image/jpeg", data.Data)
})
}
}