-
Notifications
You must be signed in to change notification settings - Fork 87
Description
Platform
ESP32
IDE / Tooling
pioarduino
What happened?
When doing a request handling such as _webserver->on("/files", HTTP_ANY, handleFileRequest, handleFileUpload), and sending a zero byte file, the handleFileUpload never gets called.
I would have expected to receive a handler call for handleFileUpload with final==true, index==0, len==0, etc.
This seems a bit awkward to do in the request handler afterward, because of the multipart upload, you can't only check the content-length, and also need to get the filename, etc.
At least if the handleFileUpload was sending a zero len/final event this would allow for a more generic and straightforward file writing implementation.
Stack Trace
There is no stack trace in this case
Minimal Reproductible Example (MRE)
Need to upload a zero byte file from a browser page designed for this, or I guess you can do it with curl as well, then implement the handler like this:
_webserver->on("/fileupload", HTTP_ANY, handleFileRequest, handleFileUpload);
void handleFileUpload(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final) {
// This never get called
}
void handleFileRequest(AsyncWebServerRequest *request) {
// This gets called
}
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).