From 43509055b110f4cc6c74dac052487aa2bdc931ae Mon Sep 17 00:00:00 2001 From: zhaoxuan Date: Wed, 15 Nov 2017 11:00:13 +0800 Subject: [PATCH] add upload api doc --- docs/UploadApi.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 docs/UploadApi.md diff --git a/docs/UploadApi.md b/docs/UploadApi.md new file mode 100644 index 0000000..247cdb4 --- /dev/null +++ b/docs/UploadApi.md @@ -0,0 +1,28 @@ +### Upload image by post + +- You can upload image by HTTP post with identifier to accesss. + +### Post file by `multipart/form-data` + +`Python` demo: + +```python +import requests + +url = 'http://localhost/php/index.php' + +fields = { + 'function': 'Photo::add', # Controller + 'albumID': 's', # album id, default s is a public album + 'identifier': 'change-to-identifier-in-database', +} + +files = { + '0': ('file_name.jpg', open('/path/to/file_name.jpg', 'rb')), +} + +response = requests.post(url, files=files, data=fields) + +print(response.status_code) +print(response.text) +```