diff --git a/main.go b/main.go index 7d85a79..c525ab3 100644 --- a/main.go +++ b/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) } diff --git a/public/views/index.html b/public/views/index.html index 41ca7a6..4e9972b 100644 --- a/public/views/index.html +++ b/public/views/index.html @@ -22,6 +22,14 @@ curl -F "file=@/path/to/file" "{{.Host}}"

+

+ Or for Tulg on a windows pc ;) + +

+ File: +
+

+

To delete a file using curl: curl "{{.Host}}/delete/file_name"