web server to read file from SD card and show its content as HTML

I include this function code to any sketch I want to check the SRAM.

int freeRam() {
  extern int __heap_start,*__brkval;
  int v;
  return (int)&v - (__brkval == 0 ? (int)&__heap_start : (int) __brkval);  
}

Then call it something like this.

Serial.print("Free SRAM = ");
Serial.println(freeRam());

It does not show 0 when you run out of memory. It will show an unrealistic amount of SRAM remaining. If I run my Mega out of memory, it will return more free SRAM than my Mega has.