note 104301 added to function.mkdir

From: Date: Tue, 07 Jun 2011 15:36:57 +0000
Subject: note 104301 added to function.mkdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-180314@lists.php.net to get a copy of this message
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 ---- Server IP: 85.214.154.209 Probable Submitter: 85.16.71.64 ---- Manual Page -- http://www.php.net/manual/en/function.mkdir.php Edit -- https://master.php.net/note/edit/104301 Del: integrated -- https://master.php.net/note/delete/104301/integrated Del: useless -- https://master.php.net/note/delete/104301/useless Del: bad code -- https://master.php.net/note/delete/104301/bad+code Del: spam -- https://master.php.net/note/delete/104301/spam Del: non-english -- https://master.php.net/note/delete/104301/non-english Del: in docs -- https://master.php.net/note/delete/104301/in+docs Del: other reasons-- https://master.php.net/note/delete/104301 Reject -- https://master.php.net/note/reject/104301 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#180314) next »