note 86357 added to function.ftp-mkdir
| From: | Ashus at osu1 dot php dot net | Date: | Tue, 14 Oct 2008 19:05:12 +0000 |
| Subject: | note 86357 added to function.ftp-mkdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-145360@lists.php.net to get a copy of this message | ||
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.');
?>
----
Server IP: 212.24.129.51
Probable Submitter: 85.135.75.196
----
Manual Page -- http://www.php.net/manual/en/function.ftp-mkdir.php
Edit -- https://master.php.net/note/edit/86357
Del: integrated -- https://master.php.net/note/delete/86357/integrated
Del: useless -- https://master.php.net/note/delete/86357/useless
Del: bad code -- https://master.php.net/note/delete/86357/bad+code
Del: spam -- https://master.php.net/note/delete/86357/spam
Del: non-english -- https://master.php.net/note/delete/86357/non-english
Del: in docs -- https://master.php.net/note/delete/86357/in+docs
Del: other reasons-- https://master.php.net/note/delete/86357
Reject -- https://master.php.net/note/reject/86357
Search -- https://master.php.net/manage/user-notes.php