From 7a5d729859a2f667658532303c2616a38f781dd2 Mon Sep 17 00:00:00 2001
From: Jon Bergli Heier Usage: POST to $scheme://$host/u with filedata given to "file" and original filename to "filename".
- Login is sent by cookies with user id in "uid" and an identifier which is sha1(uid+sha1(password)).
+
+ or
+
+
+
cURL example:
- curl -b 'uid=42; identifier=360b411581c3d516c8d55c290f039b144cea79ad' -F 'file=@image.png' -F 'filename=image.png' http://myhost/u
+
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:'
+ 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 -- cgit v1.2.3