0

I'm using HTTPClient.h for sending the image file that taken by ESP32-cam, but it sends just headers.

the important part of code :

 File fsUploadFile2 = SPIFFS.open("/picture.jgp", "r");
 HTTPClient http;
 http.begin("http://192.168.137.1:8080/"); //Specify destination for HTTP request
 http.addHeader("_token_", "d47d3c85f89d4494a336660ab705c4b4"); //Specify content-type header
 http.addHeader("_token_issuer_", "1");
 http.addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001");
 int httpResponseCode = http.sendRequest("POST", &fsUploadFile2, fsUploadFile2.size()); //Send the actual POST request
 if(httpResponseCode>0){

        String response = http.getString();  //Get the response to the request

        Serial.println(httpResponseCode);   //Print return code
        Serial.println(response);           //Print request answer

    }else{

        Serial.print("Error on sending POST: ");
        Serial.println(httpResponseCode);

  }

and i just get headers and undefined file in server. is there any correct way to post file in esp32 cam ?

also, i want to use cURL in Arduino ide but i get "no curl/curl.h".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.