Delphi Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

Delphi Examples

Bounced Mail
Bz2
Character Encoding
CSV
DKIM / DomainKey
Digital Certificates
Digital Signatures
DH Key Exchange
DSA
Email
Email Object
FTP
HTML Conversion
HTTP
IMAP
Encryption
MHT / HTML Email
NTLM
POP3
RSA
S/MIME
SMTP
Socket
Spider
SFTP
SSH
SSH Key
SSH Tunnel
String
Tar
Upload
XML
XMP
Zip Compression

More Examples...
Amazon S3
Byte Array
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
LZW

Type Conversion

 

Article: Understanding COM References in Delphi

FTP XCRC

Demonstrates how to tell Chilkat FTP2 to automatically verify an upload using XCRC. XCRC is an FTP extension supported by most FTP servers. If your FTP server does not support XCRC, then no XCRC command will be sent to verify the upload.

The XCRC command asks the FTP server to send an CRC checksum (hash) for the contents of a file. The client can then verify that the checksum matches the local file. The FTP2 Put* methods automatically do this when the AutoXcrc property is turned on.

Note: In order for the FTP2 component to know whether XCRC is supported by your FTP server, you must have the AutoFeat property turned on (which is the default setting). The AutoFeat property tells the FTP2 component to automatically request the FTP server features via the FEAT command after connecting.

Note: XCRC is new functionality that is present in the pre-release downloads at http://www.chilkatsoft.com/preRelease.asp, or in official new versions dated after 30-Oct-2007. If you have trouble, please contact support@chilkatsoft.com.

Download 32-bit Chilkat FTP2 ActiveX (.msi)

Download All 32-bit Chilkat ActiveX Components (.zip)

Download All 64-bit Chilkat ActiveX Components (.zip)

uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls,
    CHILKATFTP2Lib_TLB,
    OleCtrls;

...

procedure TForm1.Button1Click(Sender: TObject);
var
ftp: TChilkatFtp2;
success: Integer;
localFilename: String;
remoteFilename: String;

begin
ftp := TChilkatFtp2.Create(Self);

//  Any string unlocks the component for the 1st 30-days.
success := ftp.UnlockComponent('Anything for 30-day trial');
if (success <> 1) then
  begin
    ShowMessage(ftp.LastErrorText);

  end;

ftp.Hostname := 'www.example-code.com';
ftp.Username := '****';
ftp.Password := '****';

//  Turn on the AutoXcrc property:
ftp.AutoXcrc := 1;

//  Turn on session logging.  We'll want to examine it to
//  see the XCRC command:
ftp.KeepSessionLog := 1;

//  Connect and login to the FTP server.
success := ftp.Connect();
if (success <> 1) then
  begin
    ShowMessage(ftp.LastErrorText);

  end;

//  Change to the remote directory where the file will be uploaded.
success := ftp.ChangeRemoteDir('junk');
if (success <> 1) then
  begin
    ShowMessage(ftp.LastErrorText);

  end;

//  Upload a file.
localFilename := 'hamlet.xml';
remoteFilename := 'hamlet.xml';

success := ftp.PutFile(localFilename,remoteFilename);
if (success <> 1) then
  begin
    ShowMessage(ftp.LastErrorText);

  end;

//  If we examine the session log, we'll see the XCRC command:
Memo1.Lines.Add(ftp.SessionLog);

ftp.Disconnect();

ShowMessage('File Uploaded!');

//  Here is the session log showing the XCRC command:

//  220 Serv-U FTP Server v6.3 for WinSock ready...
//  .
//  USER example-code.com
//  331 User name okay, need password.
//  .
//  PASS ****
//  230 User logged in, proceed.
//  .
//  TYPE I
//  200 Type set to I.
//  .
//  SYST
//  215 UNIX Type: L8
//  .
//  FEAT
//  211-Extension supported
//   CLNT
//   MDTM
//   MDTM YYYYMMDDHHMMSS[+-TZ];filename
//   SIZE
//   SITE PSWD;EXEC;SET;INDEX;ZONE;CHMOD;MSG
//   REST STREAM
//   XCRC filename;start;end
//   MODE Z
//   MLST Type*;Size*;Create;Modify*;Win32.ea*;
//  211 End
//  .
//  CWD junk
//  250 Directory changed to /junk
//  .
//  PORT 192,168,1,103,5,144
//  200 PORT Command successful.
//  .
//  STOR hamlet.xml
//  150 Opening BINARY mode data connection for hamlet.xml.
//  226 Transfer complete.
//  .
//  XCRC hamlet.xml
//  250 3C1933BF

end;

 

© 2000-2010 Chilkat Software, Inc. All Rights Reserved.

Mail Component · .NET Email Component · XML Parser