forked from me-no-dev/ESPAsyncWebServer
-
Notifications
You must be signed in to change notification settings - Fork 87
Closed
Labels
Description
Platform
ESP32
IDE / Tooling
Arduino (IDE/CLI)
What happened?
How to handle errors in this process like:
- File name too long
- File size too big
- ...
How to abort the upload process ?
Stack Trace
Documentation issue
Minimal Reproductible Example (MRE)
In setup:
server.on ("/upload", HTTP_POST, handleUpload, handkeData);
In code (see comments in the text below):
void (AsyncWebServerRequest * request) {
request->redirect (200, "plain/text", "OK");
}
void handleData (AsyncWebServerRequest * request, String fileName, size_t index, uint8_t * data, size_t len, bool final) {
if (!index)
request->_tempFile = LittleFS.open (fileName); // what to do if this fails (file name too long, ...) ???
if (len)
request->_tempFile.write (data, len); // what to do if we run out of space ???
if (final)
request->_tempFile.close ();
}
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).