esp32 uploading multipart data to server

pksher
Posts: 5
Joined: Tue Jun 25, 2019 6:23 am

esp32 uploading multipart data to server

Postby pksher » Wed Nov 06, 2019 7:52 am

Hi guys I am using esp32 as http client to send multipart data which is basically a jpg file stored in spiffs. I need to send this file to server with the following information.

Host: some url
Content-Type: multipart/form-data
Accept: */*
Content-Disposition: form-data; name="file"; filename="timestamp.jpg"

I am doing this

Code: Select all


file = SPIFFS.open("/timestamp.jpg");
String debugLogData;

  while (file.available()) {
    debugLogData += char(file.read());
  }
  file.close();

  Serial.println("=====================================");
  Serial.println(debugLogData);
  Serial.println("=====================================");


    HTTPClient http;
 
    http.begin("https://id=some url");
   
    http.addHeader("Content-Disposition", "form-data; name=\"file\"; filename=\"timestamp.jpg\"");
    http.addHeader("Content-Type", "multipart/form-data");             
    http.addHeader("Accept", "*/*");
   


    int httpResponseCode = http.POST(debugLogData); 

    http.end(); 




Can anyone suggest something?
Regards,

tommeyers
Posts: 184
Joined: Tue Apr 17, 2018 1:51 pm
Location: Santiago, Dominican Republic

Re: esp32 uploading multipart data to server

Postby tommeyers » Thu Nov 07, 2019 9:12 pm

I suggest you state a problem because it is not clear what you want.

Maybe you want to send a large file via http

Tom
IT Professional, Maker
Santiago, Dominican Republic

Who is online

Users browsing this forum: No registered users and 62 guests