Chat freely about anything...

User avatar
By Tertius21
#87455 I Upload a file to my webserver, to display the new file in the filelist i must refresh (like Webbrowser F5) (or load it new) the webpage. How can i do that?

A redirect does not help, this does not refresh.
Code: Select allESP8266WebServer server(80);
...
server.sendHeader("Location", String("/files"), true);
server.send ( 302, "text/plain", "");   
User avatar
By freddy-a
#87464 The webserver does not actively push pages.
Your browser has to request a page from the webserver.

If you upload a new page to your webserver, nothing is going to trigger your browser (or the webserver) to refresh the page.

You could put a command in your page (the you've opened with your browser) that refreshes the page every ## seconds.

This is the HTML command:
<meta http-equiv="refresh" content="30">

And this would (probably) be the string in your ESP8266 code:
ptr +=" <meta http-equiv=\"refresh\" content=\"30\">\n";

This should be placed within the HEAD tag!
User avatar
By Tertius21
#87473 Thank you for your answer.
But a constant (any x seconds) refresh is not wanted.

I need something that I can trigger when it is needed.
Something like this:
Code: Select allESP8266WebServer server(80);
...
server.sendHeader("Location", String("/files"), true);
server.send ( 302, "text/plain", "");


is there nothing i can send to reload the website? Or something to go to a specific website? A Request like this:
Code: Select all    client.print(String("GET /") + " HTTP/1.1\r\n" +
                 "Host: " + host + "\r\n" +
                 "Connection: close\r\n" +
                 "\r\n"
                );


i know this is for a client. but is something like that not possible for a webserver?