views:

517

answers:

4

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

A: 

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...)

François
X-Ray
10.2.5 is very old, and does not actually support D2009+'s Unicode features. CodeGear never includes updates to Indy in their IDE updates, because updates have to remain interface-compatible (and Indy updates are usually not interface-compatible). You can safely remove CodeGear's default Indy installation and install a newer version manually. The current Indy version is 10.5.7.
Remy Lebeau - TeamB
A: 

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?

Lars Truijens
A: 

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

Don Dickinson
I would have to double-check Indy's past code revisions to be sure, but IIRC there was a bug in an earlier Indy 10 release where TIdFTP did transfer data in ASCII even though the TransferType was set to Binary (or vice versa, I forget which). That was fixed in a later release.
Remy Lebeau - TeamB
A: 

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.

Mark Johnson