FTP Upload. Need Help

Many thanks. It works!!! Only one question. I've inserted the code in a sketch of mine that does many other things. I've noticed that if the ftp server response is slow it stucks somewhere in your code. I think it may depend on the while statements. Is possible to write them in another way in order to avoid the problem?