<?php
//include the ftp class
include('ftp_class_inc.php');
//instantiate the class
$ftp = new ftp('paul','hello','172.16.65.239','ftp_pasv',FALSE);
//connect to the server
$ftp->connect();
//login to the server
$ftp->login();
//list the files present in the ftp dir
$ftp->listFiles();
//upload a text file from a filehandle
$ftp->ftpFPut('/var/www/html/info.txt','FTP_ASCII');
//upload a regular binary file as is
$ftp->ftpPut('/var/www/html/info.jpg','FTP_BINARY','inforemote.jpg');
//create a remote directory
$ftp->ftpCreateDirectory('testing_stuff');
//change directory to our new dir
$ftp->ftpChDir('testing_stuff');
//what is our present working dir
$ftp->getPWD();
//delete the file that we uploaded...
$ftp->deleteFile('inforemote.jpg');
//get the file 'hello.mp3' from the server and save it locally as 'hello1.mp3'
$ftp->get('hello.mp3','/var/www/html/phpclasses/hello1.mp3');
//disconnect from the server
$ftp->disconnect();
?>
|