@@ -393,6 +393,11 @@ svr.Post("/multipart", [&](const auto& req, auto& res) {
393393 << " (" << file.content_type << ") - "
394394 << file.content.size() << " bytes" << std::endl;
395395
396+ // Access additional headers if needed
397+ for (const auto& header : file.headers) {
398+ std::cout << "Header: " << header.first << " = " << header.second << std::endl;
399+ }
400+
396401 // Save to disk
397402 std::ofstream ofs(file.filename, std::ios::binary);
398403 ofs << file.content;
@@ -430,22 +435,6 @@ svr.Post("/multipart", [&](const auto& req, auto& res) {
430435});
431436```
432437
433- #### Legacy API (still supported)
434-
435- > ** Note** : The ` req.files ` field has been removed. Use ` req.form.files ` and ` req.form.fields ` instead.
436- > For backward compatibility, ` req.get_file_value() ` , ` req.has_file() ` , and ` req.get_file_values() ` methods are still available and will delegate to the new ` req.form ` API.
437-
438- ``` cpp
439- svr.Post(" /multipart" , [&](const auto & req, auto & res) {
440- // Legacy API - still works but delegates to req.form internally
441- auto ret = req.has_file("name1"); // -> req.form.has_file("name1")
442- const auto& file = req.get_file_value("name1"); // -> req.form.get_file("name1")
443- // file.filename;
444- // file.content_type;
445- // file.content;
446- });
447- ```
448-
449438### Receive content with a content receiver
450439
451440``` cpp
@@ -454,9 +443,9 @@ svr.Post("/content_receiver",
454443 if (req.is_multipart_form_data()) {
455444 // NOTE: `content_reader` is blocking until every form data field is read
456445 // This approach allows streaming processing of large files
457- MultipartFormDataItems items;
446+ FormFileItems items;
458447 content_reader (
459- [&](const MultipartFormData &item) {
448+ [&](const FormFile &item) {
460449 items.push_back(item);
461450 return true;
462451 },
@@ -781,7 +770,7 @@ auto res = cli.Post("/post", params);
781770### POST with Multipart Form Data
782771
783772``` c++
784- httplib::MultipartFormDataItems items = {
773+ httplib::FormDataInputItems items = {
785774 { "text1", "text default", "", "" },
786775 { "text2", "aωb", "", "" },
787776 { "file1", "h\ne\n\nl\nl\no\n", "hello.txt", "text/plain" },
0 commit comments