Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Binary and ASCII FTP Transfer ModesThe SetTypeBinary() and SetTypeAscii() method can be called to change the current transfer mode. The default transfer mode is binary. Once SetTypeAscii() or SetTypeBinary() is called, all subsequent transfers will occur in that mode. LOCAL loFtp LOCAL lnSuccess LOCAL lcLocalFilename LOCAL lcRemoteFilename loFtp = CreateObject('Chilkat.Ftp2') * Any string unlocks the component for the 1st 30-days. lnSuccess = loFtp.UnlockComponent("Anything for 30-day trial") IF (lnSuccess <> 1) THEN =MESSAGEBOX(loFtp.LastErrorText) QUIT ENDIF loFtp.Hostname = "ftp.secureftp-test.com" loFtp.Username = "test" loFtp.Password = "test" * Connect and login to the FTP server. lnSuccess = loFtp.Connect() IF (lnSuccess <> 1) THEN =MESSAGEBOX(loFtp.LastErrorText) QUIT ENDIF * Set the transfer mode to ASCII lnSuccess = loFtp.SetTypeAscii() IF (lnSuccess <> 1) THEN =MESSAGEBOX(loFtp.LastErrorText) QUIT ENDIF * Change to the remote directory where the file will be uploaded. lnSuccess = loFtp.ChangeRemoteDir("junk") IF (lnSuccess <> 1) THEN =MESSAGEBOX(loFtp.LastErrorText) QUIT ENDIF * Upload a file. lcLocalFilename = "hamlet.xml" lcRemoteFilename = "hamlet.xml" * Turn on session logging for the upload: loFtp.KeepSessionLog = 1 lnSuccess = loFtp.PutFile(lcLocalFilename,lcRemoteFilename) IF (lnSuccess <> 1) THEN =MESSAGEBOX(loFtp.LastErrorText) QUIT ENDIF * View the session log. You can verify visually that * the transfer was in ascii mode. ? loFtp.SessionLog loFtp.Disconnect() =MESSAGEBOX("File Uploaded!") |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2007 Chilkat Software, Inc. All Rights Reserved.
Mail Component · .NET Email Component · ASP Mail Component · XML Parser