Uploading image using esp8266
Hi. Good day. I'm trying to upload an image using esp8266 which is a wifi module. My code
if (client.connected()) {
Serial.println("Connected");
client.println("POST /v1_1/dciqwty6f/image/upload HTTP/1.1");
client.println("Host: https://api.cloudinary.com");
client.println("UPLOAD_PRESET: lokttils");
client.println("Content-Type: Image/jpeg; boundary=AaB03x");
client.println("file: http://res.cloudinary.com/demo/image/upload/remote_media/commons/2/29/Marcelo_Facini.jpg");
client.println();
client.println("Connection: close\r\n\r\n");
delay(5000);
}
but the response am getting is
{"error":{"message":"Missing required parameter - file"}}
-
Hi,
Thanks for reaching out.
Hardly an Arduino expert but judging from the error it looks like you're passing the parameters (file and upload_preset) in the headers and not in the BODY.
You can try something like this -
String PostData = "file=<image>&upload_preset=<preset>";
//After headers and Host
client.println(Postdata);
Also, worth checking out the HTTP client.
(As suggested in this GH thread)
Hope it helps.
Best,
0
Post is closed for comments.
Comments
1 comment