1
0
forked from crony/UpFast

File upload form

This one for you tulg.
This commit is contained in:
CronyAkatsuki 2023-12-21 12:08:07 +01:00
parent 66fd12473e
commit 2c1342a20e
2 changed files with 14 additions and 1 deletions

View File

@ -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)
}

View File

@ -22,6 +22,14 @@
<code>curl -F "file=@/path/to/file" "{{.Host}}"</code>
</p>
<p>
Or for <a href="https://poggerer.xyz/">Tulg</a> on a windows pc ;)
<form action="/" method="post" enctype="multipart/form-data">
File: <input type="file" name="file"> <input type="submit" value="submit">
</form>
</p>
<p>
To delete a file using curl:
<code>curl "{{.Host}}/delete/file_name"</code>