Working With Remote Files; Using Http Protocol; Using Ftp And Dav Protocol - Adobe GoLive CS2 Programmer's Manual

Hide thumbs Also See for GoLive CS2:
Table of Contents

Advertisement

SDK Programmer's Guide
}
return result;
}
For a folder, the processOneFolder function passes the folder back to the top of the
getFolderContents method, which gets its contents and dispatches the siteReference objects to
the helper functions. This recursive call processes folders until it has retrieved all the files in all the folders
that the target folder and its subdirectories contain.
// called when the current item references a folder
// calls the getFolderContents method to dispatch folder contents
processOneFolder (item, result)
{
writeln ("recursing " + item.name + " for more results.");
result = getFolderContents(item, result);
return result;
}

Working with Remote Files

The get and put methods of the
these methods, you can download a file, edit it, and then upload it again. These methods require that the
Network module be active.
The
FTP Object
you to establish a connection to any remote server using the FTP protocol. The DAV object is very similar,
but uses the WebDAV protocol to communicate with a WebDAV server.

Using HTTP protocol

The file object's get method retrieves a specified file from an HTTP server and stores it on the local file
system under the file object's name. Similarly, the put method uploads a file to an HTTP server. The put
method requires that the destination server be able to fulfill HTTP PUT requests.
Each of these methods accepts a remote URL as its argument. An optional second parameter specifies the
file's MIME type.
When either of these methods return, the file object's lastError property holds a string that is the
HTTP status text returned by the server, such as "200 OK" , "201 Created" , or "404 Not found" . To
ensure that this property contains the latest error text, assign an empty string as its value before
attempting a file I/O operation.

Using FTP and DAV protocol

The
FTP Object
read, or write the files themselves.
To download file and folders from a remote location using the FTP or WebDAV protocol, use the
getContent function of an FTP object or DAV object. Use the returned file objects to manipulate
the files locally.
The getContent method allows you to filter the search using a search mask, or retrieve only folders,
much like the file object's getFiles method.
Adobe GoLive CS2 SDK
file Object
and
DAV Object
represent files and folders on remote file servers. The FTP object allows
and
DAV Object
allow you to get and put files at the remote location, but not to open,
provide simple HTTP download and upload services. With
Managing Files and Folders
133

Advertisement

Table of Contents
loading

Table of Contents