Doubt button esp8266

sorry for my English.
Hello, I am having a doubt with the esp8266, I am putting together a tool that through an arduino nano I receive information that is sent and displayed on a page through the esp8266, what I cannot do is generate a button that, when pressed, downloads in this case the "/data.txt" when pressing the button

#include <ESP8266WiFi.h>
#include <FS.h>
#include <ESP8266mDNS.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <SPIFFSEditor.h>
#include <EEPROM.h>

#define BAUD_RATE 115200

const char *ssid = "Telecentrologger";
const char *password = "root3030"; 

AsyncWebServer server(80);
FSInfo fs_info;
File f;

void setup() {
  
  Serial.begin(BAUD_RATE);
  
  WiFi.mode(WIFI_STA);
  WiFi.softAP(ssid,password);
  
  EEPROM.begin(4096);
  SPIFFS.begin();
  
  MDNS.addService("http","tcp",80);

  f = SPIFFS.open("/data.txt", "a+");
  if(!f) Serial.println("Fallo al abrir el archivo");

  server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send(SPIFFS, "/data.txt", "text/plain");
  });

  server.on("/clear", HTTP_GET, [](AsyncWebServerRequest *request){
    f.close();
    f = SPIFFS.open("/data.txt", "w");
    request->send(200, "text/plain", "file cleared!");
  });
  
  server.begin();
}

void loop() {
  
  if(Serial.available()) {
    f.write(Serial.read());
  }
  
}

words like "arduino uno push button" can generate a result set that gives things like;

and more.

what happens is that I don't need a physical button, I need a button inside the page that generates the esp8266, I was searching but I couldn't find any help so that the button apart from appearing downloads that file that it generates

see the SimpleAuthentication example of the ESP8266WebServer library

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.