小编Guy*_*Sky的帖子

ESP32 尝试使用 HTTPClient 将图像文件发送到 php

我尝试在 esp32 上运行我的代码后得到了这个

注意:未定义索引:第 23 行 C:\xampp\htdocs\acc.php 中的 imageFile

我在 esp32 上的代码

HTTPClient http;
http.begin("http://192.168.43.86/acc.php");  //Specify destination for HTTP request
http.addHeader("Content-Disposition", "form-data; name=\"imageFile\"; filename=\"picture.jpg\"\r\n");
http.addHeader("Content-type", "image/jpeg");

int httpResponseCode = http.POST(cam.getfb(), cam.getSize());


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);

}

http.end();
Run Code Online (Sandbox Code Playgroud)

我可以使用此代码发送字符串,但我上面的代码不起作用(cam.getfb() 返回为 uint8_t,cam.getSize() 返回为 size_t)

  http.addHeader("Content-type", "application/x-www-form-urlencoded");
  int httpResponseCode = http.POST("word=" + Cword);
Run Code Online (Sandbox Code Playgroud)

php中的代码

<?php …
Run Code Online (Sandbox Code Playgroud)

php c http arduino esp32

5
推荐指数
1
解决办法
1万
查看次数

如何处理大型 http JSON 响应正文

有返回大型 JSON 数据示例结果的 REST-API:

{
   "arrayA":[
      {
         "data1":"data",
         "data2":"data"
      },..
   ],
   "arrayB":[
      {
         "data1":"data"
      },..
   ]
}
Run Code Online (Sandbox Code Playgroud)

“arrayA”可能只记录 0 到 100 条记录,但“arrayB”可能有 100 万到 1000 万条记录,这会使我的 java 应用程序内存不足。我的问题是如何处理这个案子。

java spring httpclient

1
推荐指数
1
解决办法
6638
查看次数

标签 统计

arduino ×1

c ×1

esp32 ×1

http ×1

httpclient ×1

java ×1

php ×1

spring ×1