note 86357 deleted from function.ftp-mkdir by danbrown

From: Date: Wed, 23 Mar 2011 15:11:34 +0000
Subject: note 86357 deleted from function.ftp-mkdir by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-178126@lists.php.net to get a copy of this message
Note Submitter: Ashus ---- A slight modification to Vladimir Lukianov's code sets the permissions as well. <?php function ftp_mkdir_recursive($ftpconn_id, $mode, $path) { $dir=split("/", $path); $path=""; $ret = true; for ($i=0;$i<count($dir);$i++) { $path.="/".$dir[$i]; if(!@ftp_chdir($ftpconn_id,$path)) { @ftp_chdir($ftpconn_id,"/"); if(!@ftp_mkdir($ftpconn_id,$path)) { $ret=false; break; } else { @ftp_chmod($ftpconn_id, $mode, $path); } } } return $ret; } ftp_mkdir_recursive($ftpconn_id, 0777, $dir) or die('An error while creating a directory occured.'); ?>

« previous php.notes (#178126) next »