- HTPC (házimozi PC) topik
- Vezetékes FEJhallgatók
- RAM topik
- NVIDIA GeForce RTX 5070 / 5070 Ti (GB205 / 203)
- Milyen billentyűzetet vegyek?
- Megjött a Razer DeathAdder egerek legfrissebb nemzedéke
- Elkezdtek szállingózni az Arctic P Pro sorozatú ventilátorai
- AMD Ryzen 9 / 7 / 5 9***(X) "Zen 5" (AM5)
- Milyen egeret válasszak?
- Milyen asztali (teljes vagy fél-) gépet vegyek?
-
PROHARDVER!
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
- OpenWRT topic
- iRacing.com - a legélethűbb -online- autós szimulátor bajnokság
- Vékonyabb lett, jobb kamerát kapott, de az akku maradt a régi: itt a Fold7
- HTPC (házimozi PC) topik
- A HMD visszalép az USA piacáról
- Filmvilág
- EAFC 25
- Autós topik
- gban: Ingyen kellene, de tegnapra
- Futás, futópályák
- További aktív témák...
- Hobby gamer asztali gép RGB i5-114600/RTX 2060 12GB/32 GB RAM/500 GB NVMe
- Dell Latitude E6540 Erőmű akár Játékra is.15"6 FHD,I7 4800MQ,HD8790,16GBram,500GB sshd,gyári töltö
- HP ELITEBOOK 855 G8 Ryzen 3 5400U 16gb ram 256ssd FHD IPS Gari
- HP ELITEBOOK 850 G8 i5 1145G7/16GB ram 256ssd/FHD
- Újszerű Lenovo Legion 5 - 15,6"FHD IPS - Ryzen 5 5600H - 16GB - 512GB SSD - RTX 3050 - Win11 -MAGYAR
- Eladó ÚJ Intel Core i3 10105F bontatlan dobozos processzor 3 év garancia 27% áfa
- Samsung Galaxy A12 64GB, Kártyafüggetlen, 1 Év Garanciával
- ÁRGARANCIA!Épített KomPhone Ryzen 7 7800X3D 32/64GB RAM RX 7800 XT 16GB GAMER PC termékbeszámítással
- ÁRGARANCIA! Épített KomPhone i7 14700KF 32/64GB RAM RTX 5090 32GB GAMER PC termékbeszámítással
- Bomba ár! Lenovo IdeaPad V110 - i3-6GEN I 4GB I 128GB SSD I 15,6" I HDMI I Cam I W10 I Garancia!
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Cég: Promenade Publishing House Kft.
Város: Budapest