'How to post image using Arduino HTTPClient
I am using arduino HTTPClient to do the post request in ESP32. Can anyone help me with the part where I will be able to post an image file along with some data.
The below code works perfectly fine with only sending user_name and 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);
}
Solution 1:[1]
I assume you are using ESP32. You may refer to this link
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | WenJuan |