The FileList class provides an object-oriented way to search files. Since it extends the DatabaseItemList, it also provides pagination and sorting.
Instantiating the FileList object
Loader::model('file_list'); $fl = new FileList();
Filters a list by extension. Do not include a period in the $extension string.
Filters by type of file. $fileType should be one of the following constants, which are defined in concrete/libraries/file/types.php
FileType::T_IMAGE FileType::T_VIDEO FileType::T_TEXT FileType::T_AUDIO FileType::T_DOCUMENT FileType::T_APPLICATION FileType::T_UNKNOWN
Filters files by keywords, which searches
- username of uploader
- Any file attributes marked as being included in the search index.
Only display files that are in a given FileSet.
Filters the file list by file size (in kilobytes).
$fl->filterByDateAdded($date, $comparison = '=')
Filters by date. Allows all MySQL comparison symbols (greather than, less than, etc...)
Filters by tag.
$ul->filterByAttribute($attributeKeyHandle, $value, $comparison = '=')
Filters by a user attribute key handle.
$files = $fl->get($itemsToGet = 100, $offset = 0)
Gets all files who fit the criteria.
$fl->getPage($page = false)
Gets a page of files (taking into account $itemsPerPage, current page, etc...)
Pagination and Sorting
For more information on how to paginate and sort the results of FileList query, check out the Searching and Sorting in the System section (link)