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+'
invalid operands of types 'const char*' and 'const char [8]' to binary 'operator+'
Re: invalid operands of types 'const char*' and 'const char [8]' to binary 'operator+'
use (String) before contant?
...= (String)"id=7292&num="...
...= (String)"id=7292&num="...
Re: invalid operands of types 'const char*' and 'const char [8]' to binary 'operator+'
Code: Select all
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;
Re: invalid operands of types 'const char*' and 'const char [8]' to binary 'operator+'
try
or try
String base64image = (String) "id=7292&num=" + (String)num + (String) .............. ;
or try
String base64image = (String) "id=7292&num=" + (String)num + (String) .............. ;
Who is online
Users browsing this forum: No registered users and 71 guests