Problem sending encoded image via HTTP POST? ESP32

Nothing is sent, and what error I can’t figure out in any way.

if (camClient.connect(postHost, postHttpPort))
{
uint8_t num = 1;
String base64image = "id=7292&num=" + num + (base64::encode(fb->buf, fb->len)) + "&image=";
 
Serial.println("connection");
camClient.println("POST /test/image/post.php HTTP/1.0");
camClient.println("Host: cloud.***.com");
camClient.println("Accept: */*");
camClient.println("User-Agent: Mozilla/5.0");
camClient.println("Content-Length: " + base64image.length());
camClient.println("Content-Type: image/jpeg" );
camClient.println();
 
camClient.write(base64image.c_str());
 
camClient.stop();
}
else {
// if you didn't get a connection to the server:
Serial.println("connection failed");
}

which library do you use for base64::encode(fb->buf, fb->len))and if it's String compatible, shouldn't that be after the "&image="what about memory available?

as a best practice rule, don't post snippets (Snippets R Us!)

J-M-L:
which library do you use for base64::encode(fb->buf, fb->len))and if it's String compatible, shouldn't that be after the "&image="what about memory available?

as a best practice rule, don't post snippets (Snippets R Us!)

if (camClient.connect(postHost, postHttpPort))
{
uint8_t num = 1;
String base64image = "id=7292&num=" + num + "&image=" + (base64::encode(fb->buf, fb->len));

Serial.println("connection");
camClient.println("POST /test/image/post.php HTTP/1.0");
camClient.println("Host: cloud.****.com");
camClient.println("Accept: /");
camClient.println("User-Agent: Mozilla/5.0");
camClient.println("Content-Length: " + base64image.length());
camClient.println("Content-Type: image/jpeg" );
camClient.println();

camClient.write(base64image.c_str());

//Serial.println(base64_encode_expected_len(fb->len) + 1);
//Serial.println(base64image.length());
camClient.stop();
}
else {
// if you didn't get a connection to the server:
Serial.println("connection failed");
}

How can i fix this?
Error: invalid operands of types 'const char*' and 'const char [8]' to binary 'operator+'

By adding code tags around your code and may be answering the questions ?..

String(num) would ensure you get a String out of num

J-M-L:
By adding code tags around your code and may be answering the questions ?...

String(num) would ensure you get a String out of num

uint8_t num = 12;
String stringOne, stringTwo, stringThree, stringFour;
String base64image = String();
stringOne = String("id=7292&num=");
stringThree = String("&image=");
stringFour = String(base64::encode(fb->buf, fb->len));
stringTwo = String(num);
base64image = stringOne + stringTwo + stringThree + stringFour;

it is right??

sorry don't see the code tags. My brain does not work with poorly formatted stuff.

1 if (camClient.connect(postHost, postHttpPort))
2    {
3      uint8_t num = 12;
4      String stringOne, stringTwo;
5      String image = String();
6      stringOne = String("id=7292&num=");
7      stringTwo = String("&image=");
8      image = stringOne + num + stringTwo;
9      String base64image = base64::encode(fb->buf, fb->len);
10 
11      //Serial.println("connection");
12      camClient.println("POST /test/image/post.php HTTP/1.0");
13      camClient.println("Host: cloud.***.com");
14      camClient.println("Accept: */*");
15      camClient.println("User-Agent: Mozilla/5.0");
16      camClient.println("Content-Length: " + (base64image.length() + image.length()));
17      camClient.println("Content-Type: image/jpeg" );
18      camClient.println();
19      camClient.write((image + base64image).c_str());
20      
21      //Serial.println(base64_encode_expected_len(fb->len) + 1);
22 
23      camClient.stop();
24    }
25    else {
26      // if you didn't get a connection to the server:
27      Serial.println("connection failed");
28    }

It seems that everything is fine, but nothing is transmitted through the http port

Content-Type is not "image/jpeg" but "x-www-form-urlencoded" for the request you are performing.

so
image is a String holding “id=7292&num=12&image=”

base64image is a String (not sure why you feel you have to duplicate memory) the base 64 encoding (you never answered which library) of fb->buf (you never explained what’s in there) for fb->len bytes (you never explained where this comes from).

We don’t know what camClient is and how it’s initialized?

then you end up possibly sending

POST /test/image/post.php HTTP/1.0
Host: cloud.***.com
Accept: */*
User-Agent: Mozilla/5.0
Content-Length: [color=blue]<a size number here>[/color]
Content-Type: image/jpeg
<an empty line>
id=7292&num=12&image=[color=blue]<here the base64 info>[/color]

and close the connexion

have you tried manually to see if that HTML header/content works ?

have you looked into HTTPClient.h API ?