In ExpressionEngine 7 the
File model is inheriting
FileSystemEntity model, which is also parent of
Directory model. They share same properties and most of the methods; different models are being used when there is need to distinguish between file and subfolder.
We recommend using
FileSystemEntity when you need everything that is in certain Upload Directory, and use
Directory when working specifically with files or folders within Upload Directory. When saving, the exact model (
Directory) always needs to be used.
|Primary ID of file or subfolder
|MSM site ID, default is 1
|Title (can be different from file name, often used for alt text)
|ID of Upload Directory that the file is in
|Subfolder ID, if file is in subfolder
|Registered MIME type for the file.
|File type. The built-in types are Image / Document / Archive / Audio / Video
|Name of file on filesystem
|Location where the photo was made
|ID of member who initially uploaded the file
|Date when file was initially uploaded
|ID of member who made last modification to the file
|Date when file was modified last time
|Height and width of the file when it was originally uploaded
|Number of times the file is being used in entries & categories
The location the file is uploaded to.
The user who uploaded the file.
The last user to modify the file.
Selected categories the file has.
The site the file is apart of.
Categories that are using this file as category image
Entries that are using this file
true is entity is
true is entity is
Uses the file’s mime-type to determine if the file is an image or not.
Uses the file’s mime-type to determine if the file is an editable image or not.
Uses the file’s mime-type to determine if the file is an SVG or not.
Get Filesystem object for the file’s Upload Directory
Get the subfolder path to the given file
Get base server path for file’s upload location
Get base url for upload location and folder
Get absolute path to the file on the filesystem
Get absolute path to the file’s pre-manipulated version on the filesystem. Accepts manipulation name as parameter
Uses the file’s upload destination’s server path to compute the absolute thumbnail path of the file
Uses the file’s upload destination’s url to compute the absolute URL of the file
Get URL for pre-manipulated file version. Accepts manipulation name as parameter
Get URL of file’s thumbnail
Deletes the original file
Deletes the file’s manipulated versions
Deletes the original file and all of its manipulated versions
Determines if the member has access permission to file’s upload destination.
Determines if the file exists
Determines if the file or subfolder is writable
Get an array of IDs for files and folders that belong to this
Perform some action on the file in a local context
Represents a file. Child of
FileSystemEntity and is sharing all of it’s properties and methods.
Defines some extra necessary
Represents a folder. Child of
FileSystemEntity and is sharing all of it’s properties and methods. Has extra
$file = ee('Model')->get('File', 4)->first();