mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-04-11 19:28:30 +00:00
Improvement for Multipart Form Data
This commit is contained in:
11
README.md
11
README.md
@@ -989,6 +989,17 @@ httplib::UploadFormDataItems items = {
|
||||
auto res = cli.Post("/multipart", items);
|
||||
```
|
||||
|
||||
To upload files from disk without loading them entirely into memory, use `make_file_provider`. The file is read and sent in chunks with a correct `Content-Length` header.
|
||||
|
||||
```cpp
|
||||
httplib::FormDataProviderItems providers = {
|
||||
httplib::make_file_provider("file1", "/path/to/large.bin", "large.bin", "application/octet-stream"),
|
||||
httplib::make_file_provider("avatar", "/path/to/photo.jpg", "photo.jpg", "image/jpeg"),
|
||||
};
|
||||
|
||||
auto res = cli.Post("/upload", {}, {}, providers);
|
||||
```
|
||||
|
||||
### PUT
|
||||
|
||||
```c++
|
||||
|
||||
Reference in New Issue
Block a user