note 53684 deleted from function.mkdir by mazzanet

From: Date: Wed, 17 Dec 2008 11:10:03 +0000
Subject: note 53684 deleted from function.mkdir by mazzanet
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-148258@lists.php.net to get a copy of this message
Note Submitter: Steven Ng ---- I had to remove the $path in the CHMOD command before the function worked for me. The function was at the $path directory prior to initiating the CHMOD command, so it tried to go down the $path directory again. // create directory through FTP connection function FtpMkdir($path, $newDir) { $server='ftp.server.com'; // ftp server $connection = ftp_connect($server); // connection // login to ftp server $user = "me"; $pass = "pass"; $result = ftp_login($connection, $user, $pass); // 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 ftp_site($connection, "CHMOD 777 $newDir") or die("FTP SITE CMD failed."); return $newDir; } else { return false; } ftp_close($connection); // close connection } } FtpMkdir("path","dir");

« previous php.notes (#148258) next »