Skip to content

Issue with handleUpload #71

@TheMechanos

Description

@TheMechanos

Platform

ESP32

IDE / Tooling

PlatformIO

What happened?

I'm experiencing an issue with handling file uploads in the Async Web Server on ESP32. The handleUpload function is called only once and receives only the first chunk of data.

For small files (that fit within a single chunk), the upload works correctly. However, larger files that are sent in multiple chunks fail, as handleUpload is not called for subsequent parts.

When I use latest https://github.com/me-no-dev/ESPAsyncWebServer problem don't exists.

Stack Trace

Minimal Reproductible Example (MRE)

Board: ESP32-S3

void handleUpload(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final) {
    if (!index) {
        Serial.printf("UploadStart: %s\n", filename.c_str());
    }
    if(len){
        Serial.printf("Uploading %u B\n", len);
    }
    if (final) {
        Serial.printf("UploadEnd: %s, %u B\n", filename.c_str(), index + len);
    }
}

void serverConfig(){
    server.on(
        "/api/file", HTTP_POST,
        [](AsyncWebServerRequest *request) {

            request->send(200);
        },
        handleUpload);



    server.begin();
    Serial.println("Server init done!");
}

Log:

08:35:11.487 > UploadStart: sample-3s.mp3
08:35:11.508 > Uploading 1436 B

And this is all, no more chunks.

I confirm that:

  • I have read the documentation.
  • I have searched for similar discussions.
  • I have searched for similar issues.
  • I have looked at the examples.
  • I have upgraded to the lasted version of ESPAsyncWebServer (and AsyncTCP for ESP32).

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions