add upload api doc
This commit is contained in:
parent
224025650a
commit
43509055b1
28
docs/UploadApi.md
Normal file
28
docs/UploadApi.md
Normal 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)
|
||||
```
|
Loading…
Reference in New Issue
Block a user