You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- removed intermediate SPIFFS storage
- directly send the upload buffer to the nextion over serial
- added server.on("/fs", HTTP_POST.... for receiving upload file size (Workaround as the file content-length is of by +/- 200 bytes. Known issue: esp8266/Arduino#3787)
// End the serial connection to the Nextion and softrest it
125
+
nextion.end();
126
+
127
+
Serial.println("");
128
+
//Serial.println(nextion.statusMessage);
129
+
returntrue;
117
130
}
118
131
}
119
132
133
+
120
134
voidsetup(void){
121
135
Serial.begin(115200);
122
-
Serial.print("\n");
136
+
Serial.println("");
123
137
124
138
Serial.setDebugOutput(true);
125
139
if(!SPIFFS.begin()){
@@ -137,8 +151,7 @@ void setup(void){
137
151
delay(500);
138
152
Serial.print(".");
139
153
}
140
-
Serial.println("");
141
-
Serial.print("Connected! IP address: ");
154
+
Serial.print("\nConnected! IP address: ");
142
155
Serial.println(WiFi.localIP());
143
156
144
157
MDNS.begin(host);
@@ -147,11 +160,24 @@ void setup(void){
147
160
Serial.println(".local");
148
161
149
162
//SERVER INIT
150
-
server.on("/", HTTP_POST, // if the client posts to the upload page
151
-
[](){ server.send(200); }, // Send status 200 (OK) to tell the client we are ready to receive
152
-
handleFileUpload // Receive and save the file
163
+
server.on("/", HTTP_POST, [](){
164
+
Serial.println("Succesfull upload\n");
165
+
166
+
// Redirect the client to the success page after handeling the file upload
167
+
server.sendHeader("Location","/success.html");
168
+
server.send(303);
169
+
returntrue;
170
+
},
171
+
// Receive and save the file
172
+
handleFileUpload
153
173
);
154
174
175
+
// receive fileSize once a file is selected (Workaround as the file content-length is of by +/- 200 bytes. Known issue: https://github.com/esp8266/Arduino/issues/3787)
0 commit comments