fix files uploading
This commit is contained in:
parent
7e65712103
commit
0ae5eb4325
6
main.go
6
main.go
@ -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)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user