Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 PHP Code: MKDIR with error checking Jump to:  
Category: >> PHP Code >> MKDIR with error checking Bookmark and Share

<< lastnext >>

Snippet Name: MKDIR with error checking

Description: A mkdir function with a simple exception handler.

Comment: (none)

Language: PHP
Highlight Mode: PHP
Last Modified: March 11th, 2009

<?PHP
 
FUNCTION handleError() {
    TRIGGER_ERROR('MY ERROR');
 
    /** usage sample
        @handleError();
        echo $php_errormsg;
    */
}
 
// detect slash/backslash nomenclature dirname
$path = DIRNAME( __FILE__ );
$slash = '/'; STRPOS( $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;
 
}
 
?>


Free
Oracle Magazine
Subscriptions
and Oracle White Papers


SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 116 users online    © 2009 psoug.org

PSOUG LOGIN
Username: 
Password: 
Forgot your password?