note 92844 added to function.mkdir
| From: | BrianS at osu1 dot php dot net | Date: | Tue, 11 Aug 2009 15:51:09 +0000 |
| Subject: | note 92844 added to function.mkdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-159337@lists.php.net to get a copy of this message | ||
The example from "hinom - iMasters" below is broken -- here's a version that works:
<?php
function handleError() {
trigger_error('MY ERROR');
/** usage sample
@handleError();
echo $php_errormsg;
*/
}
// detect slash/backslash nomenclature dirname
$path = dirname( __FILE__ );
$slash = '/';
(stristr( $path, $slash )) ? '' : $slash = '\\';
define( 'BASE_DIR', $path . $slash );
$folder = time(); // folder name
$dirPath = BASE_DIR . $folder; // folder path
// print results
echo $slash;
echo '<hr>';
$rs = @mkdir( $dirPath, '0777' );
@handleError();
if( $rs )
{
// print success information
echo 'was done!';
echo '<br>folder: <a href="' . $folder . '">' .
$folder . '</a>';
echo '<br>dirPath: ' . $dirPath;
}else{
// print error information
echo 'an error was occurred. Attempting create folder';
echo '<br>dirPath: ' . $dirPath;
echo '<br>php_errormsg: ' . $php_errormsg;
}
?>
----
Server IP: 193.95.141.37
Probable Submitter: 84.203.121.164
----
Manual Page -- http://www.php.net/manual/en/function.mkdir.php
Edit -- https://master.php.net/note/edit/92844
Del: integrated -- https://master.php.net/note/delete/92844/integrated
Del: useless -- https://master.php.net/note/delete/92844/useless
Del: bad code -- https://master.php.net/note/delete/92844/bad+code
Del: spam -- https://master.php.net/note/delete/92844/spam
Del: non-english -- https://master.php.net/note/delete/92844/non-english
Del: in docs -- https://master.php.net/note/delete/92844/in+docs
Del: other reasons-- https://master.php.net/note/delete/92844
Reject -- https://master.php.net/note/reject/92844
Search -- https://master.php.net/manage/user-notes.php