Support Joomla!

references:joomla.framework:filesystem:jfolder-create

Table of Contents

create

API Package Subpackage Class Method Reference Last reviewed Doc status
API Home Package Joomla.Framework Subpackage FileSystem Class JFolder Method create Reference create() Never Work in Progress

Creates a folder and all necessary parent folders. Thus, if invoked to create a folder called ‘level1/level2/level3/newfolder’ it will create the ‘level1’, ‘level2’ and ‘level3’ folders if they do not exist and will then create the ‘newfolder’ folder. If safe mode is enabled, FTP will be used to create the folder (if it is enabled). This method will not create a folder if the ‘open_basedir’ parameter is set and the specified folder is not in the allowed base folder. This function returns true on success, false otherwise.

Syntax

boolean create ( $path, $mode )

$path string is a string containing the path to create, relative to the base path.
$mode int is an integer containing the folder permissions to set for created folders. These permissions follow UNIX file permission standards. This parameter is optional and if omitted defaults to 0755.

Examples

Example

jimport( 'joomla.filesystem.folder' );
if (JFolder::create( 'test2/test' )) {
    echo "Folder successfully created!";
} else {
    echo "Folder creation failed!";
}

might produce:

Result

Folder successfully created!

Discussion

Dan3000, 2006/04/30 11:27:

“folder” folder ??? a bit confusing? changed it


Dan3000, 2006/04/30 11:28:

what does this piece of code do? jimport( ‘joomla.filesystem.folder’ )


chrisdavenport, 2006/05/02 11:58:

jimport is a function which calls JLoader, the ‘smart’ class loader. It is defined in libraries/loader.php. Without it you would get an ‘undefined class’ error when you tried to call JFolder::create.


Full name:
E-Mail:
 
references/joomla.framework/filesystem/jfolder-create.txt (2060 views) · Last modified: 2007/08/15 15:06