note 104301 deleted from function.mkdir by crell
| From: | crell@php.net | Date: | Wed, 29 Jun 2022 19:14:56 +0000 |
| Subject: | note 104301 deleted from function.mkdir by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218703@lists.php.net to get a copy of this message | ||
Note Submitter: toppi at kacke dot de
----
If you have problems with the SAFE MODE Restriction in effect i.e. if you try to create and access
to subdirectorys recursive you can use ftp-lib like this.
<?php
DEFINE ('FTP_USER','yourUser');
DEFINE ('FTP_PASS','yourPassword');
/**
* Returns the created directory or false.
*
* @param Directory to create (String)
* @return Created directory or false;
*/
function mkDirFix ($path) {
$path = explode("/",$path);
$conn_id = @ftp_connect("localhost");
if(!$conn_id) {
return false;
}
if (@ftp_login($conn_id, FTP_USER, FTP_PASS)) {
foreach ($path as $dir) {
if(!$dir) {
continue;
}
$currPath.="/".trim($dir);
if(!@ftp_chdir($conn_id,$currPath)) {
if(!@ftp_mkdir($conn_id,$currPath)) {
@ftp_close($conn_id);
return false;
}
@ftp_chmod($conn_id,0777,$currPath);
}
}
}
@ftp_close($conn_id);
return $currPath;
}
?>
Maybe it helps.
Toppi