mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-10-14 10:29:35 +00:00
Improvement for Multipart Form Data
This commit is contained in:
1 parent
43cf1822c6
commit
2280f1d191
3 files changed
+216
-12
No files matched your search
@@ -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