SD card as a buffer (using sdfatlib beta)

Could this be it?

if (i > sentFile.fileSize())

Change to:

if (i >= sentFile.fileSize())