note 53684 added to function.mkdir

From: Date: Thu, 09 Jun 2005 06:37:23 +0000
Subject: note 53684 added to function.mkdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-90159@lists.php.net to get a copy of this message
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"); ---- Manual Page -- http://www.php.net/manual/en/function.mkdir.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+53684 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53684&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53684&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53684&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53684&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53684&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+53684&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#90159) next »