Hans du Plooy wrote:
I'm still getting one error:
Warning: ftp_close() expects parameter 1 to be resource, null given
in /home/www/web3/web/testftp.php on line 33
Ah.. debugging.. not so much fun for us non-coders.
The error msg says enough though. ftp_close() should contain the
connection.. and in this
script is refers a $conn_id .
Now, I can't find the $conn_id anywhere, so null IS expected.
A quick look suggests that you should change the $conn_id in
$connection, as $connection contains
the ftp_connect + info for the connection it self.
I could just as well be off base here, I can't say I'm a coder aswell.
<?
phpinfo();
$server='localhost'; // ftp server
$connection = ftp_connect($server); // connection
// login to ftp server
$user = "xxxxxxx";
$pass = "xxxxxxx";
$result = ftp_login($connection, $user, $pass);
ftp_pasv ($connection, 1);
// $gallery_path = '/home/www/web3/web/';
$gallery_path = '/web/';
$path = $gallery_path;
$newDir = 'mynewdirectory';
// check if connection was made
if ((!$connection) || (!$result)) {
return false;
exit();
}
else {
ftp_chdir($connection, $path); // go to destination dir
if(ftp_mkdir($connection,$newDir)) { // create directory
$chmod_cmd="CHMOD 0777 ".$newDir;
$chmod=ftp_site($connection, $chmod_cmd);
echo $newDir;
} else {
return false;
}
ftp_close($conn_id); // close connection
}
?>
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]