Problem putting images on webserver using ajax inside SD memory

Hello everyone! How are you?

This is my first post and I hope somebody can help with my problem. I'm sending attached all the files I'm using. I'm grateful for any help.

I have an Arduino UNO + Ethernet Shield combo. I'm creating a project where I have to:

  • Control 4 digital outputs
  • Read 3 digital inputs
  • Read 4 analogic inputs

My interface is totally through a webpage that is hosted inside a micro-SD memory. At the moment, everything is offline. To start learning, I was following this awesome tutorial: http://startingelectronics.com/tutorials/arduino/ethernet-shield-web-server-tutorial/. I followed all the steps, managed to make all the examples work and then started to build my own project.

I was getting all the parts together and then I got stuck in a part where I have to put some images in the webpage from the micro-SD memory. For some reason, I'm not able to load the images. Everything works fine until I add this part that asks Arduino to send the image:

/if (StrContains(HTTP_req, "Button-Log-Off-icon.png")) {
webFile = SD.open("Button-Log-Off-icon.png");
if (webFile) {
client.println("HTTP/1.1 200 OK");
client.println();
Serial.print("OFF! \n");
if (webFile) {
while(webFile.available()) {
client.write(webFile.read()); // send web page to client
}
webFile.close();
}
}
}
/

When I add this part for some reason Arduino stops to communicate with the browser. I can't understand the reason... What can I be doing wrong?

Thanks again! Best regards,

PikachuLegolas_V0_13.zip (36 KB)

Just adding more information, I'm sending two images of the HTTP requests. "Log Problem" is what I get when it's not working (when I add the mentioned part) and "Log Ok" is when the communication is fine (without the mentioned part).

Logs.zip (155 KB)