next up previous contents
Next: Methods Up: FFish Script Objects Reference Previous: onGetUrl   Contents

Inet.Ftp Object

Description

Gains access to ftp servers. The object provides abilities to connect a ftp server, list files and directories on the ftp server, download and upload files, create or remove directories, rename or delete files, etc.

available: SWFKit, SWFKit Pro


Syntax

This object must be returned by the Inet.openFtp method.


Usage

1. Open an Inet.Ftp object
The Inet.Ftp object is created by the Inet.openFtp method.

var ftp = Inet.openFtp("ftp://192.168.1.3");
2. Connect to the ftp server

ftp.connect();

3. Change the current directory

trace(ftp.currentDir);
ftp.currentDir = "/pub/samples";

4. List the files and folders

var list = ftp.list();
for (i = 0; i < list.files.length; i++)
    trace(list.files[i]);
for (i = 0; i < list.folders.length; i++)
    trace(list.folders[i]);

5. Get the file size

var info = ftp.getFileInfo("test.rar");
trace(info.size);

6. Download or upload files

ftp.onDownload = function (percent)
{
    trace(percent);
    return true;
}

ftp.download("test.rar", "c:\\samples\\test.rar");


ftp.onUpload = function (percent)
{
    trace(percent);
    return true;
}

ftp.upload("test.rar", "c:\\samples\\test_new.rar");




Subsections

Copyright ©2000-2007 Shanghai TopCMM Software Technologies. All Rights Reserved.