In the doStore function, the data.available return value may be less than the complete file size, if all tcp packets have not been received when the call is made. The problem is then that closeTransfer() will be called regardless, i.e. before the entire file is received, and the transfer will be interrupted. The code changes will allow additional doStore() iterations before closeTransfer is called. Tested OK on both ESP32 and ESP8266. Note: on ESP32, use arduino lib newer than 10 july, 2018.
In the doStore function, the data.available return value may be less than the complete file size, if all tcp packets have not been received when the call is made. The problem is then that closeTransfer() will be called regardless, i.e. before the entire file is received, and the transfer will be interrupted. The code changes will allow additional doStore() iterations before closeTransfer is called. Tested OK on both ESP32 and ESP8266. Note: on ESP32, use arduino lib newer than 10 july, 2018.