FTP Class

Released 7 years ago , Last update 7 years ago

Recursive upload or download files from FTP

This class can be used to send and receive files from FTP servers.

It can connect to a given FTP server, upload files to a destination directory, download files to local directory, create directories and sub-directories, change the current directory and list the files in a directory.

How to use

Include the FTP class:

require 'path/to/ftp.php';

Create an FTP class instance:

$config = array(
    'passive_mode' => true, // true | false
    'transfer_mode' => FTP_BINARY, // FTP_ASCII | FTP_BINARY
    'reattempts' => 3, // Number of time to re-attempt connection
    'log_path' => '/logs', // Path to log file
    'verbose' => true, //true | false
    'create_mask' => '0755' // default: 0777

$ftp = new ftp($config);

//Connect to FTP server
$ftp->conn('ftp.server.tld', 'username', 'password');

You should enable passive mode if server is behind NAT and doesn't have a public IP address.

Use methods put() and get() for handling files - put() for uploading files to server and get() for downloading files from ftp server.

You can download entire directories thanks the recursive() method.

This class requires PHP5 with FTP extension installed.

  • 5 4
  • 4 1
  • 3 0
  • 2 1
  • 1 0
6 Reviews Read Reviews


14 day 14-day money-back guarantee


MIT license

The MIT license is an open-source license.

License » MIT license Download

Get A Quote

What do you need?
  • Custom development
  • Integration
  • Customization / Reskinning
  • Consultation
When do you need it?
  • Soon
  • Next week
  • Next month
  • Anytime

Thanks for getting in touch!

Your quote details have been received and we'll get back to you soon.

Or enter your name and Email
No comments have been posted yet.