File upload form
This one for you tulg.
This commit is contained in:
parent
66fd12473e
commit
2c1342a20e
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)
|
||||
}
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user