Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Paul Scott  >  phpftp  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example Script
Class: phpftp
Wrapper to the PHP extension to access FTP servers
Author: By
Last change:
Date: 2006-01-08 22:35
Size: 950 bytes
 

Contents

Class file image Download
<?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();
?>