Skip to main content
deleted 255 characters in body
Source Link

how How to post image using esp32Arduino HTTPClient

I am new to esp32, I am using arduino HTTPClient to push code into esp32do the post request in ESP32. Can anyone help me with the code using whichpart where I will be able to post an image file along with some data in the server using esp32.

I have tried this codeThe below but still it does notcode works for me.perfectly fine with only sending user_name and image_type-

static esp_post_img()
{
  esp_err_t res = ESP_OK;

  esp_http_client_handle_t#include http_client;<HTTPClient.h>
  
  esp_http_client_config_t config_client = {0};
  config_clienthttp.url = post_url;
  config_clientbegin("https://www.event_handler = _http_event_handler;somelink.com/post-image");
  config_client
http.method =addHeader("Content-Type", HTTP_METHOD_POST;"application/x-www-form-urlencoded");

 String http_clienthttpRequestData = esp_http_client_init(&config_client);"user_name=Shidhartha&image_type=Outdoor";
  
 int esp_http_client_set_post_field(http_client,httpResponseCode post_data,= strlenhttp.POST(post_data)httpRequestData);
 
  esp_http_client_set_headerif(http_client,httpResponseCode "Content-Type",> "image/jpg"0);
{
  esp_err_tString errresponse = esp_http_client_performhttp.getString(http_client);
  if Serial.println(err == ESP_OKresponse) ;
}else{
    Serial.print("esp_http_client_get_status_code"Error on sending POST: ");
    Serial.println(esp_http_client_get_status_code(http_client)httpResponseCode);
}

how to post image using esp32

I am new to esp32, I am using arduino to push code into esp32. Can anyone help me with the code using which I will be able to post an image file along with some data in the server using esp32.

I have tried this code below but still it does not works for me.

static esp_post_img()
{
  esp_err_t res = ESP_OK;

  esp_http_client_handle_t http_client;
  
  esp_http_client_config_t config_client = {0};
  config_client.url = post_url;
  config_client.event_handler = _http_event_handler;
  config_client.method = HTTP_METHOD_POST;

  http_client = esp_http_client_init(&config_client);
  
  esp_http_client_set_post_field(http_client, post_data, strlen(post_data));
 
  esp_http_client_set_header(http_client, "Content-Type", "image/jpg");

  esp_err_t err = esp_http_client_perform(http_client);
  if (err == ESP_OK) {
    Serial.print("esp_http_client_get_status_code: ");
    Serial.println(esp_http_client_get_status_code(http_client));
}

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);
}
added 713 characters in body
Source Link

I am new to esp32, I am using arduino to push code into esp32. Can anyone help me with the code using which I will be able to post an image file along with some data in the server using esp32.

I have tried this code below but still it does not works for me.

static esp_post_img()
{
  esp_err_t res = ESP_OK;

  esp_http_client_handle_t http_client;
  
  esp_http_client_config_t config_client = {0};
  config_client.url = post_url;
  config_client.event_handler = _http_event_handler;
  config_client.method = HTTP_METHOD_POST;

  http_client = esp_http_client_init(&config_client);
  
  esp_http_client_set_post_field(http_client, post_data, strlen(post_data));

  esp_http_client_set_header(http_client, "Content-Type", "image/jpg");

  esp_err_t err = esp_http_client_perform(http_client);
  if (err == ESP_OK) {
    Serial.print("esp_http_client_get_status_code: ");
    Serial.println(esp_http_client_get_status_code(http_client));
}

I am new to esp32, I am using arduino to push code into esp32. Can anyone help me with the code using which I will be able to post an image file along with some data in the server using esp32.

I have tried this code below but still it does not works for me.

I am new to esp32, I am using arduino to push code into esp32. Can anyone help me with the code using which I will be able to post an image file along with some data in the server using esp32.

I have tried this code below but still it does not works for me.

static esp_post_img()
{
  esp_err_t res = ESP_OK;

  esp_http_client_handle_t http_client;
  
  esp_http_client_config_t config_client = {0};
  config_client.url = post_url;
  config_client.event_handler = _http_event_handler;
  config_client.method = HTTP_METHOD_POST;

  http_client = esp_http_client_init(&config_client);
  
  esp_http_client_set_post_field(http_client, post_data, strlen(post_data));

  esp_http_client_set_header(http_client, "Content-Type", "image/jpg");

  esp_err_t err = esp_http_client_perform(http_client);
  if (err == ESP_OK) {
    Serial.print("esp_http_client_get_status_code: ");
    Serial.println(esp_http_client_get_status_code(http_client));
}
Source Link

how to post image using esp32

I am new to esp32, I am using arduino to push code into esp32. Can anyone help me with the code using which I will be able to post an image file along with some data in the server using esp32.

I have tried this code below but still it does not works for me.