#def title: help #def header: help #extends templates.base #def content
Usage: POST to $scheme://$host/u with filedata given to "file" and original filename to "filename". Login is sent by cookies with either:
cURL example:
curl -b 'uid=42; identifier=360b411581c3d516c8d55c290f039b144cea79ad' -F 'file=@image.png' -F 'filename=image.png' -F 'api=1' http://myhost/u
Here user id is 42 and the password is "foobar".
If you get HTTP 417 responses, try adding:-H 'Expect:'
.
By adding the key-value pair "api=1" you will get machine-readable responses in the form: response result
where response
is either ERROR
or OK
,
and result
is the file hash in the case of OK
, or an error message in the case of ERROR
.
The hash can be used to construct URLs in which the paths begin with /f/hash
where hash
is the hash received.
Any file extension an be appended to the hash, and for convenience the original filename (or whatever filename you prefer) can be appended after an additional slash after the hash.
#end def