       www.fastrprint((char*)buf);
     }
     
-    www.fastrprint("--"); www.fastrprint(FORM_BOUNDARY); www.fastrprint("--");
+    www.fastrprint(FORM_BOUNDARY); www.fastrprint("--");
+    
+    
+    // Read data until either the connection is closed, or the idle timeout is reached.
+    byte i = 0;
+    unsigned long lastRead = millis();
+    while (www.connected() && (millis() - lastRead < IDLE_TIMEOUT_MS)) {
+      while (www.available() && (i < strlen(SUCCESS_RESPONSE))) {
+        char c = www.read();
+        if ((i < strlen(SUCCESS_RESPONSE)) && c != SUCCESS_RESPONSE[i++]) {
+          Serial.print(FAIL_MSG);
+          return 2;
+        }
+        Serial.print(c);
+        lastRead = millis();
+      }
+    }
+    
+    Serial.print(OK_MSG);
     
   } else {
     Serial.print(FAIL_MSG);

SdCard card;
Fat16 file;

#define FORM_BOUNDARY "KegScribeCSVFile"

void initSD() {
  pinMode(SD_CHIP_SELECT_PIN, OUTPUT);

    Serial.print("read ");
    cbPrintFilename(filename, dir);
    Serial.print(filename);
    
    file.open(filename, O_READ);
    if (!file.isOpen()) {
      // no more files
