HOME DOWNLOAD PURCHASE DOCS SAMPLES SUPPORT CONTACT
EaseWe FTP OCX ActiveX Control Documentation
1.Properties:
Busy
Connected
ErrorInfo
ErrorNumber
FileSize
FileTypeAllow
FileTypeForbid
FtpState
KeepConnSecond
LeftTime
LocalPath
MaxChunkSize
MaxSize
MessageInfo
OverWrite
PassiveMode
PassWord
Percent
QueueIndex
QueueTotal
RaiseErrorEvent
ReDoTimes
RemotePath
RemotePort
RenameRule
ReplaceSetting
ServerName
Speed
Text
TimeOut
TransferSize
UserName
Version
2.Methods:
Abort
AbortCurrent
About
ChangeTransferList
CloseConnection
Connect
CreateDirectory
DeleteFile
DownLoad
ExeFtpCmd
ExistDirectory
ExistFile
FormatFileSize
FormatTime
GetCurrentDirectory
GetFileExtendName
GetFileName
GetFtpDirectoryInfo
GetFtpFileInfo
GetFtpFileSize
GetLocalFileDate
GetLocalFileSize
GetLocalFolderFileCount
GetLocalFolderSize
GetParentDirectory
GetParentFolderPath
LocalFileExists
LocalFolderExists
RemoveDirectory
RenameFile
SetCurrentDirectory
ShowBrowseFolderDialog
ShowOpenFileDialog
ShowSaveFileDialog
UpLoad
3.Events:
OnError
OnServerMessage
OnStateChange
OnTransfer
1.Properties:Back to top
Busy:
Indicates whether an operation is in progress.
If an operation is in progress this value is true, otherwise false.
Connected:
Checks if client is connected to FTP server,return true on success and false on failure;
ErrorInfo:
Detailed description of error;
ErrorNumber:
The number of error;Click here to open error code listing
FileSize:
The total size of the file in transferring;
FileTypeAllow:
The file type allowed to transfer,each file type is separated by ';',such as "txt;doc";
FileTypeForbid:
The file type forbidden to transfer,each file type is separated by ';',such as "asp;aspx";

FtpState:
The state code of ftp server,it is always used in event 'OnStateChange';

The following are main items:

ftpFreeState
ftpConnecting
ftpConnected
ftpAuthentication
ftpUserLoggedIn
ftpUploadInProgress
ftpUploadCompleted
ftpDownloadInProgress
ftpDownloadCompleted
ftpRetrievingDirectoryInfo
ftpDirectoryInfoRetrieved
ftpQuiting
ftpClosed
KeepConnSecond:
Check connection every "KeepConnSecond" seconds;
LeftTime:
The transfer remaining time of current file, the unit is second;
LocalPath:Back to top
The file path to be uploaded or the save path of download;
MaxChunkSize:
Maximum block size in transfer,unit is KB, default is 1000KB;
The actual block size is adjusted from 50KB to MaxChunkSize by ActiveX Control automatically according to bandwidth.
MaxSize:
The maximum file size of a transfer, the unit is MB;
MessageInfo:
The information response from ftp server.

It is always used in event 'OnServerMessage';
OverWrite:
Specifies whether to overwrite existing files.
1:Default:Display Confirm File Replace dialog;

2.If set to true,the file will be replaced;
3.If set to false,the transfer will resume automatically;

You can also control the dialog by property ReplaceSetting;
PassiveMode:
Specifies whether to use passive mode, default is true;
PassWord:Back to top
The password to login to the FTP server;
Percent:
The percent of the file transfer completed;

It is always used in event 'OnTransfer';
QueueIndex:
The sequence of transferring file on transfer queue.

It is always used in event 'OnTransfer';
QueueTotal:
The number of files on transfer queue.

It is always used in event 'OnTransfer';
RaiseErrorEvent:
Specifies whether to raise the event 'OnError',default is false;
ReDoTimes:
Automatic reconnect and resume transfer how many times when the connection is lost or broken.
RemotePath:
The remote file path on server.
RemotePort:
The port number of the server, default is 21;
RenameRule:
The rule of rename a file automatically;
Default is "{oldname}1",it means that {oldname} will be replaced with old file name;
For example:
If the old file name is "test.htm",the new file name will become "test1.htm" after rename.

ReplaceSetting:
The value of 'ReplaceSetting' is used to control the buttons in 'Confirm File Replace'.

The selectable value of 'ReplaceSetting':

0:Show 'Confirm file Replace' dialog;

1:Overwrite;
2:Resume;
3:Skip;
4:Rename;(The rule of rename is set by property 'RenameRule')

ServerName:
Host name of the server;
Speed:
Transfer speed, the unit is bytes/s;
You can use the method "FormatFileSize(FtpLibrary1.Speed)/s" convert the unit to "KB/s" or "MB/s";

It is always used in event 'OnTransfer';
Text:Back to top
Gets or sets the message text of the ocx;
The step of supporting other languages:
1.Get all the words of the ocx to a string variable by property 'FtpLibrary1.Text';
2.Translate the words from english into other languages.
3.Set the translated words to property 'FtpLibrary1.Text' for other languages supported.
TimeOut:
Specifies the timeout in seconds for the control and data connection, default is 30 seconds;
TransferSize:
The size of the file transfer completed,the unit is byte;

It is always used in event 'OnTransfer';
UserName:
The user name to login to the FTP server, default is anonymous;
Version:
The version of ActiveX control;
2.Methods:Back to top
Abort():
Aborts transferring all the files on queue;
AbortCurrent():
Aborts the current operation;
About():
Show information of ActiveX control;
ChangeTransferList(FilePath,Delete):
Remove a file from queue;
FilePath:The file path that need to be removed from queue;
Delete(Optional):
If set to True,the file will be removed from queue;
If set to False,the file has been removed will be added to the queue again.
CloseConnection():
Quits FTP session and disconnects from FTP server;
Connect():
Connects to remote host, return true on success and false on failure;

CreateDirectory(DirectoryPath,Recursive):
Creates a new directory, return true on success and false on failure;
DirectoryPath:The directory path to create.
Recursive(Optional):Whether create parent directory recursively or not.

DeleteFile(FilePath):
Deletes a file from the server, return true on success and false on failure;
FilePath:The path of the file you want to delete from server.
DownLoad():
Downloads the specified remote file to the specified local file, return true on success and false on failure;
ExeFtpCmd(Cmd,Arguments):
Sends specified command to ftp server;
For example:ExeFtpCmd("size","filename.txt")
ExistDirectory(DirectoryName):Back to top
Check whether the specified directory exists on server;
ExistFile(FileName):Back to top
Check whether the specified file exists on server;(Available for V4.5.0.5 or later)
FormatFileSize(FileSize):
Convert file size from bytes to human readable format.
eg.2048 becomes 2KB,2048000 becomes 2MB.
FormatTime(Seconds):
Convert LeftTime from seconds to "hh:mm:ss".
eg.FormatTime(290) will return "04:50".
GetCurrentDirectory():
Returns the current/working directory on server;
GetFileExtendName(FilePath):
Returns the file extension name of the specified path;
GetFileName(FilePath):
Returns the file name and extension of the specified path;
GetFtpDirectoryInfo(DirectoryPath):
Get a list of subfolders and files in the specified folder on server, return an array of CFtpFiles;
GetFtpFileInfo(FilePath):Back to top
Returns the size and last modified date of the specified file on server, return a type of CFtpFile.
GetFtpFileSize(FilePath):
Returns the size of the specified file on server.

If file not found return -1;
If an error occurs return -2;
GetLocalFileDate(FilePath):
Returns the last modified date of the specified local file.;
GetLocalFileSize(FilePath):
Returns the size of the specified local file;
GetLocalFolderFileCount(FolderPath):
Returns the number of files in the specified local folder;
GetLocalFolderSize(FolderPath):
Returns the size of the specified local folder;
GetParentDirectory():
Returns the parent directory of the current/working directory on server;
GetParentFolderPath(FolderPath):
Returns the parent folder of the specified path;
LocalFileExists(FilePath):
Checks whether the specified local file exists; return true on success and false on failure;
LocalFolderExists(FolderPath):
Checks whether the specified local folder exists; return true on success and false on failure;
RemoveDirectory(DirectoryPath):
Deletes a directory from the FTP server;return true on success and false on failure;
RenameFile(OldFileName,NewFileName):
Renames the remote file or directory on the FTP server;return true on success and false on failure;
SetCurrentDirectory(DirectoryPath):
Changes the current/working directory on server;return true on success and false on failure;
ShowBrowseFolderDialog(DefaultFolder):
Show browse folder dialog;
DefaultFolder(Optional): The default folder path of the "Browse Dialog".
ShowOpenFileDialog(FileFilter,MultiSelect):
Show "Open File" dialog;
FileFilter(Optional): The file types allow to display in "Open File" dialog,such as:*.txt;*.doc;*.exe
MultiSelect(Optional):Whether support multi-select or not.Default is True.
ShowSaveFileDialog(FileName):
Show "Save File" dialog;
FileName(Optional): The default file name displays in "Save File" dialog.
UpLoad():
Uploads the specified local file to specified remote path. return true on success and false on failure
3.Events:Back to top
OnError:
The event is fired when an error occurs and property 'RaiseErrorEvent' is set to True;

Private Sub FtpLibrary1_OnError()
Debug.Print FtpLibrary1.ErrorInfo & "(" & FtpLibrary1.ErrorNumber & ")"
End Sub
OnServerMessage:
The event is fired when the ocx get response from FTP server ;

Private Sub FtpLibrary1_OnServerMessage()
Debug.Print FtpLibrary1.MessageInfo
End Sub
OnStateChange:
The event is fired when the state of ftp is changed.

Private Sub FtpLibrary1_OnStateChange()
If FtpLibrary1.FtpState = FtpStates.ftpUploadCompleted Then
Debug.Print "State: Upload Completed"
ElseIf FtpLibrary1.FtpState = FtpStates.ftpDownloadCompleted Then
Debug.Print "State: Download Completed"
End If
End Sub
OnTransfer:
The event occurs during a file transfer.
You can get the transfer process in this event;

Private Sub FtpLibrary1_OnTransfer()
Debug.Print FtpLibrary1.Percent & "%(" & FtpLibrary1.FileSize & "/" & FtpLibrary1.TransferSize & ")"
Debug.Print FtpLibrary1.FormatFileSize(FtpLibrary1.Speed) & "/s"
Debug.Print FtpLibrary1.FormatTime(FtpLibrary1.LeftTime)
End Sub

 

Home Download Purchase Documentation Samples Screenshots Support Contact Links