There is a method called "streamFile"
just like server.sendContent or sendHeader
Usage is: template<typename T> size_t streamFile(T &file, String contentType)
Exxample usage:
Code: Select allFile dataFile = SD.open("/path/file");
if(server.streamFile(dataFile,"image/jpeg") != dataFile.size()) {
Serial.printLn("Did not stream entire file, maybe file path not correct!");
}
dataFile.close(),
Tip: Create your webpage HTML in a way that does not make multiple file requests at once. For example, a webpage with multiple image tags, the browser will try to download more than one at one time. This will overload the ESP and it will crash. Small files, such as html,js,css are ok, but large files such as images not so. Instead, spread the load by loading one file at a time.
I used simple onload js method to load one pic at a time in a gallery. This allowed one pic to load and as soon as it was downloaded, the next one would get picked up and so on. This worked well for me.
Here is a full webserver sample(not mine) in git on how it is used. You'll be able to pull the bits you need and get it to work (Read/Write files to SD card via webserver)
https://github.com/esp8266/Arduino/blob ... Server.ino