I am having trouble using TidFTP to upload a file. The source is a known good zip file and the code below is used to transfer it. It transfers apparently fine and I can use the FTP viewer WinSCP to drag and drop the site copy back to my desktop again but then it will not open with a 'Zip file is invalid' message. The file is about 137k and there is a 3 byte file size difference between the uploaded file and the source, so clearly they are not the same. If I un-comment the verify operation this too returns FALSE.
Can anyone suggest where I might look? I'm using Delphi 10 and Windows 10.
procedure TForm1.Button1Click(Sender: TObject);
var
FTP : TidFTP;
const
sSourceFile = 'C:\scratch\hope.zip';
sDestFolder = '/scratch';
sDestFileName = 'hope.zip';
begin
FTP := TidFTP.Create( nil );
try
FTP.Host := 'www.mysite.co.uk';
FTP.Username := 'username';
FTP.Password := 'password';
FTP.Passive := True;
FTP.TransferTimeout := 1000;
FTP.ConnectTimeout := 2000;
FTP.ReadTimeout := 3000;
FTP.Connect();
FTP.ChangeDir( sDestFolder );
FTP.Put( sSourceFile, sDestFileName );
//if not FTP.VerifyFile( sSourceFile, sDestFileName ) then
// ShowMessage( 'File verify error' );
ShowMessage( 'done' );
finally
FTP.Disconnect;
FTP.Free;
end;
end;