- bigyo108: A vén PC-Főnix újjászületése
- Luck Dragon: Asszociációs játék. :)
- sziku69: Szólánc.
- D1Rect: Nagy "hülyétkapokazapróktól" topik
- sziku69: Fűzzük össze a szavakat :)
- Meggyi001: RTX 5060 - Az új népkártya?
- btz: Internet fejlesztés országosan!
- eBay-es kütyük kis pénzért
- bitpork: Phautós tali a Balcsinál 2025 Augusztus 2 napján (szombat)
- bambano: Bambanő háza tája
Hirdetés
Talpon vagyunk, köszönjük a sok biztatást! Ha segíteni szeretnél, boldogan ajánljuk Előfizetéseinket!
-
LOGOUT
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
- Kerékpárosok, bringások ide!
- Philips LCD és LED TV-k
- AMD Ryzen 9 / 7 / 5 9***(X) "Zen 5" (AM5)
- Honor Magic5 Pro - kamerák bűvöletében
- Milyen TV-t vegyek?
- Már játszható a Titan Quest II korai változata PC-n
- Gaming notebook topik
- OLED TV topic
- Lexus, Toyota topik
- Telekom mobilszolgáltatások
- További aktív témák...
- Samsung Galaxy A04s 32GB Kártyafüggetlen 1Év Garanciával
- Telefon felvásárlás!! iPhone 16/iPhone 16 Plus/iPhone 16 Pro/iPhone 16 Pro Max
- HP 14 Elitebook 1040 G9 FHD+ IPS i5-1245U 10mag 16GB 512GB 5G Modem Intel Iris XE Win11 Pro Garancia
- Bomba ár! Lenovo ThinkPad L13 G3 - i5-1245U I 16GB I 256SSD I 13,3" FHD Touch I NBD Gari!
- Apple Watch SE 40mm 32GB, Kártyafüggetlen, 1 Év Garanciával
Állásajánlatok
Cég: FOTC
Város: Budapest