Hirdetés
- Bemutatkozott a Poco X7 és X7 Pro
- iPhone topik
- November 24-én jön a Honor 500, itt az első kép róla
- Fordulat: időben startol S26+, nézd meg, milyen lesz!
- Szakított a OnePlus és a Hasselblad
- Amazfit Helio Strap – képernyőmentesen
- Milyen hagyományos (nem okos-) telefont vegyek?
- Honor Magic6 Pro - kör közepén számok
- Apple iPhone 13 Pro Max - őnagysága
- Samsung Galaxy S25 Ultra - titán keret, acélos teljesítmény
-
Mobilarena
Arduino hardverrel és szoftverrel foglakozó téma. Minden mikrovezérlő ami arduinoval programozható, és minden arduino program, board, és hardverrel kapcsolatos kérdések helye.
Új hozzászólás Aktív témák
-
Tomika86
senior tag
válasz
Janos250
#17922
üzenetére
Köszönöm a választ!
És ha jól gondolom ezek is csak azért vannak, hogy az spiffs-ről beolvassa a tartalmakat.
String getContentType(String filename){
if(server.hasArg(F("download"))) return F("application/octet-stream");
else if(filename.endsWith(F(".htm"))) return F("text/html");
else if(filename.endsWith(".html")) return F("text/html");
else if(filename.endsWith(F(".css"))) return F("text/css");
else if(filename.endsWith(F(".js"))) return F("application/javascript");
else if(filename.endsWith(F(".png"))) return F("image/png");
else if(filename.endsWith(F(".gif"))) return F("image/gif");
else if(filename.endsWith(F(".jpg"))) return F("image/jpeg");
else if(filename.endsWith(F(".ico"))) return F("image/x-icon");
else if(filename.endsWith(F(".xml"))) return F("text/xml");
else if(filename.endsWith(F(".pdf"))) return F("application/x-pdf");
else if(filename.endsWith(F(".zip"))) return F("application/x-zip");
else if(filename.endsWith(F(".gz"))) return F("application/x-gzip");
return F("text/plain");
}
bool handleFileRead(String path) { // send the right file to the client (if it exists)
Serial.print("handleFileRead: " + path);
if (path.endsWith("/")) path += "index.html"; // If a folder is requested, send the index file
String contentType = getContentType(path); // Get the MIME type
String pathWithGz = path + ".gz";
if (SPIFFS.exists(pathWithGz) || SPIFFS.exists(path)) { // If the file exists, either as a compressed archive, or normal
if (SPIFFS.exists(pathWithGz)) // If there's a compressed version available
path += ".gz"; // Use the compressed verion
File file = SPIFFS.open(path, "r"); // Open the file
size_t sent = server.streamFile(file, contentType); // Send it to the client
file.close(); // Close the file again
Serial.println(String("\tSent file: ") + path);
return true;
}
Serial.println(String("\tFile Not Found: ") + path); // If the file doesn't exist, return false
return false;
}
Új hozzászólás Aktív témák
- World of Tanks - MMO
- PlayStation 5
- Assetto Corsa Rally
- NFL és amerikai futball topik - Spoiler veszély!
- AMD Navi Radeon™ RX 6xxx sorozat
- Kuponkunyeráló
- Luck Dragon: Asszociációs játék. :)
- Újra nekifeszül az asztali konzolok piacának a Valve
- Milyen billentyűzetet vegyek?
- Audi, Cupra, Seat, Skoda, Volkswagen topik
- További aktív témák...
- Azonnali készpénzes GAMER / üzleti notebook felvásárlás személyesen / csomagküldéssel korrekt áron
- Samsung Galaxy S23 Ultra 5G 512GB, Kártyafüggetlen, 1 Év Garanciával
- MSI Katana GF76 - 17.3"FHD 144Hz - i5-11400H - 8GB - 512GB - Win11 - RTX 3050 Ti - MAGYAR
- GYÖNYÖRŰ iPhone 13 mini 128GB Blue -1 ÉV GARANCIA - Kártyafüggetlen, MS3847, 100% Akkumulátor
- Xbox Series X 1 TB + kontroller 6 hó garancia, számlával!
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: NetGo.hu Kft.
Város: Gödöllő
ekkold

