PHP Classes

File: Doc

Recommend this page to a friend!
  Classes of Kristian Feldsam  >  FTP best class  >  Doc  >  Download  
File: Doc
Role: Documentation
Content type: text/plain
Description: Documentation
Class: FTP best class
Recursive Upload and download files via FTP
Author: By
Last change: new doc
Date: 11 years ago
Size: 1,153 bytes


Class file image Download
In your PHP script u have to include ftp class php file like this

require 'path/to/ftp.php';

them u must initialize class object for example:

$config = array(); keys[passive_mode(true|false)|transfer_mode(FTP_ASCII|FTP_BINARY)|reattempts(int)|log_path|verbose(true|false)|create_mask(default:0777)]

$ftp = new ftp($config);

and call conn method
$ftp->conn('ftp.server.tld', 'username', 'password');

You should need enable passive mode, if server on scripts runs is after NAT and dont have public IP address.

example with required params:

require 'path/to/ftp.php';

$ftp = new ftp();
$ftp->conn('ftp.server.tld', 'username', 'password');

them u will use methods put() and get(). Put for uploading files to server and Get for downloading files from ftp server.

You can download entire directories - thanks for my method Recursive. Example

I want download directory /web/images from ftp server to downloads/ftp/web/images

$ftp->get('downloads/ftp/web/images', '/web/images');

first parameter is destination file and second is source file. Put method is similar.

this class require PHP5 with ftp mod installed.
For more information send a message to info at phpclasses dot org.