ESP8266的POST操作

lazyduck
Posts: 1
Joined: Wed Apr 14, 2021 4:53 pm

ESP8266的POST操作

Postby lazyduck » Wed Apr 14, 2021 4:59 pm

如题,我在使用ESP8266进行联网操作,SDK例程中有一个例子:esp_http_client。
我想使用里面的POST操作,上传一个比较大的文件(在TF卡里,有几百K),文件大小超过了8266的RAM,想问下这种情况应该怎么处理?

Code: Select all

    // POST
    const char *post_data = "field1=value1&field2=value2";
    esp_http_client_set_url(client, "http://httpbin.org/post");
    esp_http_client_set_method(client, HTTP_METHOD_POST);
    esp_http_client_set_post_field(client, post_data, strlen(post_data))
    err = esp_http_client_perform(client);
    if (err == ESP_OK) {
        ESP_LOGI(TAG, "HTTP POST Status = %d, content_length = %d",
                esp_http_client_get_status_code(client),
                esp_http_client_get_content_length(client));
    } else {
        ESP_LOGE(TAG, "HTTP POST request failed: %d", err);
    }

Her Mary
Posts: 494
Joined: Mon Oct 27, 2014 11:09 am

Re: ESP8266的POST操作

Postby Her Mary » Fri May 07, 2021 3:26 pm

文件多大的都有,分割成一段一段的发送呢?

Who is online

Users browsing this forum: No registered users and 5 guests