Update espmega_iot_core.cpp

This commit is contained in:
Siwat Sirichai 2023-12-07 13:59:23 +07:00
parent e2bf2610b3
commit 4c54da6e34
1 changed files with 4 additions and 7 deletions

View File

@ -545,16 +545,13 @@ void ota_begin()
otaserver.on("/lcd_update",HTTP_POST,[]() {
otaserver.sendHeader("Connection","close");
},[](){
for(int i=0;i<otaserver.headers();i++) {
// Print all headers
Serial.printf("HEADER[%s]:[%s]\n", otaserver.headerName(i).c_str(), otaserver.header(i).c_str());
}
HTTPUpload &upload = otaserver.upload();
size_t file_size = 0;
if(upload.status == UPLOAD_FILE_START) {
for(int i=0;i<otaserver.headers();i++) {
if(!otaserver.headerName(i).compareTo("Content-Length")) {
Serial.printf("Content-Length: %s\n",otaserver.header(i).c_str());
file_size = otaserver.header(i).toInt();
}
}
Serial.println(file_size);
lcd_upload_start(file_size);
} else if (upload.status == UPLOAD_FILE_WRITE) {