Update espmega_iot_core.cpp
This commit is contained in:
parent
e2bf2610b3
commit
4c54da6e34
|
@ -545,16 +545,13 @@ void ota_begin()
|
||||||
otaserver.on("/lcd_update",HTTP_POST,[]() {
|
otaserver.on("/lcd_update",HTTP_POST,[]() {
|
||||||
otaserver.sendHeader("Connection","close");
|
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();
|
HTTPUpload &upload = otaserver.upload();
|
||||||
size_t file_size = 0;
|
size_t file_size = 0;
|
||||||
if(upload.status == UPLOAD_FILE_START) {
|
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);
|
Serial.println(file_size);
|
||||||
lcd_upload_start(file_size);
|
lcd_upload_start(file_size);
|
||||||
} else if (upload.status == UPLOAD_FILE_WRITE) {
|
} else if (upload.status == UPLOAD_FILE_WRITE) {
|
||||||
|
|
Loading…
Reference in New Issue