Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using IdFTP->Put()

Status
Not open for further replies.

beier

Technical User
May 6, 2006
10
DK
I'm using the component TIdFTP to upload some files to an FTP server. My problem is that for some files, only a fraction of the actual filesize is uploaded(1,49 kb out of 49,5 kb in one case). This seems to only happen if I try oploading .exe files, i havent had any problem with .txt files, exept from when I rename my .exe file to a .txt file, and upload, i get the same error, so perhaps it could be the size(?). I have uploded a 60,9 kb .txt file without problems though..

Pretty short, the source code is something like this:
I have set up Host, Port, User and Password.
Code:
IdFTP->Connect();
IdFTP->ChangeDir("A Dir");
IdFTP->Put("c:\\Programs\\Stuff\\More Stuff\\Some exe.exe", "Some exe.exe", false);
IdFTP->Disconnect();
I have the same problem using IdFTP->Get, if anyone has any kind of solution to this problem it would be greatly apriciated. :)
 
I found a solution to my problem.

IdFTP->TransferType should be set to ftBinary, instead of ftASCII.

TransferType is a TIdFTPTransferType property that indicates the file transfer type currently in use for the FTP client, and can contain one of the following values:

ftBinary - Binary (8 bit) file transfers
ftASCII - ASCII (7 bit) file transfers

An application should use the ftBinary transfer type for transferring executables, compressed files, graphics, and multimedia files. Use the ftASCII transfer type for 7bit ASCII files, such as text or Hyper Text Markup Language.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top