如何使用 Arduino HTTPClient post 图像

How to post image using Arduino HTTPClient

我正在使用 arduino HTTPClient 在 ESP32 中执行 post 请求。谁能帮我 post 图像文件和一些数据。

下面的代码仅发送 user_name 和 image_type-

就可以正常工作
#include <HTTPClient.h>

http.begin("https://www.somelink.com/post-image");

http.addHeader("Content-Type", "application/x-www-form-urlencoded");

String httpRequestData = "user_name=Shidhartha&image_type=Outdoor";

int httpResponseCode = http.POST(httpRequestData);
if(httpResponseCode > 0){
  String response = http.getString();
  Serial.println(response);
}else{
  Serial.print("Error on sending POST: ");
  Serial.println(httpResponseCode);
}

我假设您使用的是 ESP32。你可以参考这个link