TypeBinary must be done after logon and before transfert.
Display FTP messages to see what happend.
Add error checking.

Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <twsocket@elists.org>
Sent: Monday, July 23, 2007 11:28 AM
Subject: [twsocket] [begginer] TFtpClient : Put binary file : corrupted


> Hi,
>
> I do my first step with FTPClient (ICS).
>
> I have difficulties with binary file transfert.
>
> With my example : text file are successfully uploaded.
> But binary files (JPG picture..) are corrupted : the size is good but not
the
> containt : when I compare files with fc /B command (file comparaison
utility
> from DOS), data are corrupted.
>
> Where is my error?
>
> Thanks for your help.
>
>
>
> My example :
>
>   // Configuring FTP transfert
>   FtpClient1.UserName:=FTPUser;
>   Ftpclient1.PassWord:=FTPPassWord;
>   FtpClient1.HostName:=FTPServeur;
>
>
>   //Set BINARY
>   FTPClient1.TypeBinary;
>
>
>   //Connecting on root directory
>
>   FtpClient1.HostDirName:='./';
>
>   FtpClient1.Connect;
>
>
>   // the array UploadDonnees contains a list of text files names to upload
>   // Chemin is a subdirectory already created
>   if (nb_donnees>0) then
>   begin
>     for i:= 1 to nb_donnees do
>     begin
>
>          FtpClient1.HostDirName:='./text/'+chemin;
>          FtpClient1.cwd;
>          FtpClient1.HostFileName:=UploadDonnees[i];
>
> FtpClient1.LocalFileName:=Chemin_Donnees+'\'+chemin+'\'+UploadDonnees[i];
>          fichierencours.caption:=UploadDonnees[i];
>          FtpClient1.Put;
>     end;
>   end;
>
>
>   // the array UploadDonnees contains a list of binary files names to
upload
>
>   if (nb_attach>0) then
>   begin
>
>
>     for i:= 1 to nb_attach do
>     begin
>
>          FtpClient1.HostDirName:='./binary/'+chemin;
>          FtpClient1.cwd;
>          FtpClient1.HostFileName:='attach';
>          FtpClient1.Mkd;
>          FtpClient1.Pwd;
>          FtpClient1.HostDirName:='attach';
>          FtpClient1.cwd;
>          FtpClient1.Pwd;
>          FtpClient1.HostFileName:=UploadAttach[i];
>
>
FtpClient1.LocalFileName:=Chemin_Donnees+'\'+chemin+'\attach\'+UploadAttach[
i];
>          fichierencours.caption:=UploadAttach[i];
>          FtpClient1.Put;
>     end;
>   end;
>
>
>   FtpClient1.Quit;
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to