Add support for file uploading #16
@ -9,7 +9,7 @@ the command line.
|
|||||||
## USAGE
|
## USAGE
|
||||||
|
|
||||||
# Upload a file
|
# 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
|
# Shorten a URL
|
||||||
curl -F'shorten=http://example.com/some/long/url' <a href="//{{.Request.Host}}">https://{{.Request.Host}}</a>
|
curl -F'shorten=http://example.com/some/long/url' <a href="//{{.Request.Host}}">https://{{.Request.Host}}</a>
|
||||||
@ -17,4 +17,4 @@ the command line.
|
|||||||
# Shorten a URL with a token to delete it later
|
# Shorten a URL with a token to delete it later
|
||||||
curl -F'shorten=http://example.com/some/long/url' -F'deleteToken=' <a href="//{{.Request.Host}}">https://{{.Request.Host}}</a>
|
curl -F'shorten=http://example.com/some/long/url' -F'deleteToken=' <a href="//{{.Request.Host}}">https://{{.Request.Host}}</a>
|
||||||
</pre>
|
</pre>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -7,7 +7,7 @@ the command line.
|
|||||||
## USAGE
|
## USAGE
|
||||||
|
|
||||||
# Upload a file
|
# Upload a file
|
||||||
curl -F'file=@yourfile.png' {{.Request.Host}}
|
curl -F'file=@yourfile.png' https://{{.Request.Host}}
|
||||||
|
|
||||||
# Shorten a URL
|
# Shorten a URL
|
||||||
curl -F'shorten=http://example.com/some/long/url' https://{{.Request.Host}}
|
curl -F'shorten=http://example.com/some/long/url' https://{{.Request.Host}}
|
||||||
|
19
paste.go
19
paste.go
@ -24,17 +24,22 @@ type paste struct {
|
|||||||
TimeCreated time.Time
|
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
|
||||||
|
|||||||
|
// "// deprecated" if you want to remove the constant. Additions are only
|
||||||
|
// allowed at the bottom of this block, for the same reason.
|
||||||
const (
|
const (
|
||||||
pasteTypeUndef pasteType = 0
|
pasteTypeUndef pasteType = iota
|
||||||
pasteTypePaste = 1
|
pasteTypePaste
|
||||||
pasteTypeRedirect = 2
|
pasteTypeRedirect
|
||||||
pasteTypeFileUpload = 3
|
pasteTypeFileUpload
|
||||||
mrngm
commented
The type of the other states is not 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 (
|
const (
|
||||||
pasteStateUndef pasteState = 0
|
pasteStateUndef pasteState = iota
|
||||||
pasteStatePresent = 1
|
pasteStatePresent
|
||||||
pasteStateDeleted = 2
|
pasteStateDeleted
|
||||||
)
|
)
|
||||||
|
|
||||||
func (t pasteType) String() string {
|
func (t pasteType) String() string {
|
||||||
|
Loading…
Reference in New Issue
Block a user
See below comment