app using TIdFTP not migrating from Delphi 5 to Delphi 2009…corrupt uploads
-
12-09-2019 - |
Question
i wrote a Delphi 5 app that uses TIdFTP. it's been working great for years. it's only purpose is to upload an excel file.
object ftp: TIdFTP
OnStatus = ftpStatus
IPVersion = Id_IPv4
AutoLogin = True
Host = 'somewhere.ca'
Passive = True
Password = 'guess'
TransferType = ftBinary
Username = 'xray'
ProxySettings.ProxyType = fpcmNone
ProxySettings.Port = 0
end
i recently migrated to delphi 2009 since i reloaded my machine and delphi 5 is gone now.
the app still looks like it's working but--most of the way through the 1.5 MB file the file becomes corrupt. it looks like bytes have been deleted and the uploaded file is shorter than the original (by about 200 bytes).
my first thought was the transfer type so i set it to Binary but beyond that, i don't know.
any ideas?
thank you! mp
Solution
What version of Indy are you using? Have you tried the latest one?
Also, did you try with other types of files (plain text, executables...)
OTHER TIPS
A big difference between Delphi 5 and Delphi 2009 is that Delphi 2009 uses Unicode. Maybe you're mixing unicode and non-unicode up? Receiving ASCII, but treating it like UTF8 for example?
like yours, my first thought is that the transfer isn't happening binary ... this seems more likely given your follow-up that changing the file name fixes the problem. do you have a packet sniffer that you can use to follow the ftp conversation? by doing that you'll be able to tell for sure if the mode is being correctly set.
-don
Delphi 5 doesn't have Indy component already installed. So, you have to download it and install it yourself. I never did get it to work. Now, I am using Delphi 7 and it already had it preinstalled. So, I never had a problem with Indy. Its only when I download it for use.