Add support for file uploading #16

Manually merged
mrngm merged 4 commits from dsprenkels/upload into master 2019-11-29 18:36:38 +01:00
3 changed files with 15 additions and 10 deletions
Showing only changes of commit b3357185f4 - Show all commits

View File

@ -9,7 +9,7 @@ the command line.
## USAGE
# Upload a file
curl -F'file=@yourfile.png' <a href="{{.Request.Host}}">{{.Request.Host}}</a>
curl -F'file=@yourfile.png' <a href="//{{.Request.Host}}">https://{{.Request.Host}}</a>
# Shorten a URL
curl -F'shorten=http://example.com/some/long/url' <a href="//{{.Request.Host}}">https://{{.Request.Host}}</a>

View File

@ -7,7 +7,7 @@ the command line.
## USAGE
# Upload a file
curl -F'file=@yourfile.png' {{.Request.Host}}
curl -F'file=@yourfile.png' https://{{.Request.Host}}
# Shorten a URL
curl -F'shorten=http://example.com/some/long/url' https://{{.Request.Host}}

View File

@ -24,17 +24,22 @@ type paste struct {
TimeCreated time.Time
}
// Note: we use iota here. That means removals of pasteType* are not allowed,
// because this changes the value of the constant. Please add the comment
Outdated
Review

See below comment

See below comment
// "// deprecated" if you want to remove the constant. Additions are only
// allowed at the bottom of this block, for the same reason.
const (
pasteTypeUndef pasteType = 0
pasteTypePaste = 1
pasteTypeRedirect = 2
pasteTypeFileUpload = 3
pasteTypeUndef pasteType = iota
pasteTypePaste
pasteTypeRedirect
pasteTypeFileUpload
Outdated
Review

The type of the other states is not pasteState, see https://play.golang.org/p/lVjTWBgRQU-

The type of the other states is not `pasteState`, see https://play.golang.org/p/lVjTWBgRQU-
)
// Note: we use iota here. See the comment above pasteType*
const (
pasteStateUndef pasteState = 0
pasteStatePresent = 1
pasteStateDeleted = 2
pasteStateUndef pasteState = iota
pasteStatePresent
pasteStateDeleted
)
func (t pasteType) String() string {