Reputation: 26650
Looking at corrupted files on FTP server I think about verifying files uploaded with TIdFtp.Put
by downloading them just after upload and comparing byte-to byte.
I think that TIdFtp
may be theoretically caching data and return it from cache instead of actually downloading.
Please allay or confirm my concerns.
Upvotes: 0
Views: 251
Reputation: 596206
No, there is no caching, as there is no such thing in the FTP protocol in general. TIdFTP
deals only with live data.
Are you, perhaps, uploading binary files in ASCII mode? If so, that would alter line break characters (CR and LF) during transmission. That is a common mistake to make, since ASCII is FTP's default mode. Make sure you are setting the TIdFTP.TransferType
property as needed before transferring a file. ASCII mode should only be used for text files, if used at all.
And FWIW, you may not need to download a file to verify its bytes. If the server supports any X<Hash>
commands (where Hash
can be SHA512
, SHA256
, SHA1
, MD5
, or CRC
) , TIdFTP
has VerifyFile()
methods to use them. That calculates a hash of a local file and then compares it to a hash calculated by the server for a remote file. No transfer of file data is needed.
Upvotes: 2