Skip to content

FilePlatform

Where the file places live: a platform the library knows, or a root of your own.

Named once, in CkSettings::FilePlatform. On a platform the library knows, each FilePlace is the folder that platform keeps for such files, found through the platform's own constant or function — nothing to configure, and the folders are the ones a developer on that platform expects. With Custom, the application says one root in CkSettings::DefaultFileRoot and each place is the subfolder named after it. Whatever the platform, a place can be given a folder of its own in CkSettings::FileRoot() or in the variable CommonKit__Files__<Place>__Root, which wins.

Members

Member Where the places are Found through
Custom One root, each place the subfolder named after it: Images/, Documents/, Uploads/. The default. CkSettings::DefaultFileRoot, or the variable CommonKit__Files__Root
Joomla Pictures, video and audio under images/, the media manager's folder — Images and Media are that folder, Videos and Audio subfolders of it; scratch in tmp/; Documents, Uploads, Imports, Exports and Archives each a folder of its own at the site root. JPATH_ROOT
Laravel What is served under storage/app/public — images/, media/, videos/, audio/ — and the rest under storage/app: documents/, uploads/, temporary/, imports/, exports/, archives/. storage_path()
WordPress Every place a lowercase folder of its own under the uploads folder, beside the media library's own year folders: uploads/images/, uploads/documents/, … wp_upload_dir(), or WP_CONTENT_DIR before the site has loaded that far

The platform's base — images/, storage/app, the uploads folder — must exist; the place's folder below it is made the first time something is written there. A platform that has not loaded yet refuses every operation with a reason that names what is missing: "the platform's root is not available (JPATH_ROOT is not defined)".

The enum is backed by an int — Custom is 0, Joomla 1, Laravel 2, WordPress 3.

Where it is used

CkSettings::FilePlatform alone, which every file operation on CkFile reads to find a place's folder. Each Frameworks page — Laravel, Joomla!, WordPress — shows the one line that sets it and the folders it gives.

Quick look

// no-check
// in your copy of CkSettings.php: the one line that says where the places live
public const FilePlatform = FilePlatform::Laravel;