File upload form
This one for you tulg.
This commit is contained in:
parent
66fd12473e
commit
2c1342a20e
2 changed files with 14 additions and 1 deletions
7
main.go
7
main.go
|
@ -183,5 +183,10 @@ func Upload(c echo.Context) error {
|
|||
|
||||
fileUrl := c.Request().Host + "/files/" + file.Filename + "\n"
|
||||
|
||||
return c.String(http.StatusOK, fileUrl)
|
||||
UserAgent := c.Request().UserAgent()
|
||||
|
||||
if regexp.MatchString("^curl/.*", UserAgent); err != nil {
|
||||
return c.String(http.StatusOK, fileUrl)
|
||||
}
|
||||
return c.Redirect(http.StatusMovedPermanently, "/files/"+file.Filename)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue