add upload api doc

This commit is contained in:
zhaoxuan 2017-11-15 11:00:13 +08:00
parent 224025650a
commit 43509055b1

28
docs/UploadApi.md Normal file
View File

@ -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)
```