blob: bdf95d47db1f6266f3f9a7323acc2a9e810175b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#def title: help
#def header: help
#extends templates.base
#def content
<p>Usage: POST to <a href="$scheme://$host/u">$scheme://$host/u</a> with filedata given to "file" and original filename to "filename".
Login is sent by cookies with either:
<ul>
<li>user id in "uid" and an identifier which is sha1(uid+sha1(password))</li>
</ul>
or
<ul>
<li>username in "username" and an identifier which is sha1(username+sha1(password))</li>
</ul>
</p>
<p>cURL example:
<blockquote><code>curl -b 'uid=42; identifier=360b411581c3d516c8d55c290f039b144cea79ad' -F 'file=@image.png' -F 'filename=image.png' -F 'api=1' http://myhost/u</code></blockquote>
Here user id is 42 and the password is "foobar".
If you get HTTP 417 responses, try adding:<code>-H 'Expect:'</code>.</p>
<p>By adding the key-value pair "api=1" you will get machine-readable responses in the form: <code>response result</code> where <code>response</code> is either <code>ERROR</code> or <code>OK</code>,
and <code>result</code> is the file hash in the case of <code>OK</code>, or an error message in the case of <code>ERROR</code>.
The hash can be used to construct URLs in which the paths begin with <code>/f/hash</code> where <code>hash</code> is the hash received.</p>
<p>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.</p>
#end def
|