<?php
if ($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST)) {
//Define your host, username, password and directory name
define('FTP_HOST', 'FTP Host/IP Name');
define('FTP_USER', 'FTP User Name');
define('FTP_PASS', 'FTP Password');
define('DIR_NAME', 'Your Directory Name');
//Post file element
$arrPostFile = $_FILES['fleFile'];
//Include the class
include('class.ftpupload.php');
//Create the FTP object
$ftpObj = new FTPClient();
//Connect
$ftpObj->connect(FTP_HOST, FTP_USER, FTP_PASS);
//Make directory
$ftpObj->makeDir(DIR_NAME);
//Upload local file to new directory on server
$ftpObj->uploadFile($arrPostFile, DIR_NAME);
//Display message
$ftpObj->pr($ftpObj->getMessages());
}
?>
<form action="" method="post" enctype="multipart/form-data">
<label>File:</label><input type="file" name="fleFile" id="fleFile" /><br />
<input type="submit" value="upload" />
</form>
|