_init()
append()
close_file()
copy()
copy_dir()
create()
create_dir()
delete()
delete_dir()
download()
exists()
file_info()
forge()
get()
get_permissions()
get_size()
get_time()
get_url()
instance()
open_file()
read()
read_dir()
rename()
rename_dir()
symlink()
update()
$areas
File Class
package | Fuel |
---|---|
subpackage | Core |
category | Core |
_init()
append(string $basepath, string $name, string $contents, string | \Fuel\Core\File_Area | null $area) : bool
string
directory where to write the file
string
filename
string
contents of file
\InvalidPathException |
|
---|---|
\FileAccessException |
|
\OutsideAreaException |
bool
close_file(resource $resource, string | \Fuel\Core\File_Area | null $area)
resource
open file resource
copy(string $path, string $new_path, string | \Fuel\Core\File_Area | null $source_area, string | \Fuel\Core\File_Area | null $target_area) : bool
string
path path to file to copy
string
new_path new base directory (full path)
string
\Fuel\Core\File_Area
null
source_area source path file area name, object or null for non-specific
string
\Fuel\Core\File_Area
null
target_area target path file area name, object or null for non-specific. Defaults to source_area if not set.
\FileAccessException |
|
---|---|
\InvalidPathException |
|
\OutsideAreaException |
bool
copy_dir(string $path, string $new_path, string | \Fuel\Core\File_Area | null $source_area, string | \Fuel\Core\File_Area | null $target_area)
string
path to directory which contents will be copied
string
new base directory (full path)
string
\Fuel\Core\File_Area
null
source path file area name, object or null for non-specific
string
\Fuel\Core\File_Area
null
target path file area name, object or null for non-specific. Defaults to source_area if not set.
\FileAccessException |
when something went wrong |
---|---|
\InvalidPathException |
|
\OutsideAreaException |
create(string $basepath, string $name, null $contents, string | \Fuel\Core\File_Area | null $area) : bool
string
directory where to create file
string
filename
null
contents of file
\FileAccessException |
|
---|---|
\InvalidPathException |
|
\OutsideAreaException |
bool
create_dir(string $basepath, string $name, int $chmod, string | \Fuel\Core\File_Area | null $area) : bool
string
directory where to create new dir
string
dirname
int
(octal) file permissions
\FileAccessException |
|
---|---|
\InvalidPathException |
|
\OutsideAreaException |
bool
delete(string $path, string | \Fuel\Core\File_Area | null $area) : bool
string
path to file to delete
\FileAccessException |
|
---|---|
\InvalidPathException |
|
\OutsideAreaException |
bool
delete_dir(string $path, bool $recursive, bool $delete_top, string | \Fuel\Core\File_Area | null $area) : bool
string
path to directory to delete
bool
whether to also delete contents of subdirectories
bool
whether to delete the parent dir itself when empty
\FileAccessException |
|
---|---|
\InvalidPathException |
|
\OutsideAreaException |
bool
download(string $path, string | null $name, string | null $mime, string | \Fuel\Core\File_Area | null $area, bool $delete, string $disposition)
string
file path
string
null
custom name for the file to be downloaded
string
null
custom mime type or null for file mime type
bool
delete the file after download when true
string
disposition, must be 'attachment' or 'inline'
exists(string $path, string | \Fuel\Core\File_Area | null $area) : bool
string
path to file to check
bool
file_info(string $path, string | \Fuel\Core\File_Area | null $area) : array
string
file path
\FileAccessException |
|
---|---|
\InvalidPathException |
|
\OutsideAreaException |
array
forge(array $config)
get(string $path, array $config, string | \Fuel\Core\File_Area | null $area) : \Fuel\Core\File_Handler_File
string
path to the file or directory
array
configuration items
get_size(string $path, mixed $area) : int
string
path to the file or directory
mixed
file area name, object or null for base area
\FileAccessException |
|
---|---|
\InvalidPathException |
|
\OutsideAreaException |
int
the file's size in bytesget_time(string $path, string $type, string | \Fuel\Core\File_Area | null $area) : int
string
path to the file or directory
string
modified or created
\FileAccessException |
|
---|---|
\InvalidPathException |
|
\OutsideAreaException |
int
Unix Timestampget_url(string $path, array $config, null $area) : bool
string
array
null
bool
instance(string | \Fuel\Core\File_Area | null $area) : \Fuel\Core\File_Area
open_file(resource | string $path, \Fuel\Core\constant | bool $lock, string | \Fuel\Core\File_Area | null $area) : bool | resource
resource
string
file resource or path
\Fuel\Core\constant
bool
either valid lock constant or true=LOCK_EX / false=LOCK_UN
\FileAccessException |
|
---|---|
\OutsideAreaException |
bool
resource
read(string $path, bool $as_string, string | \Fuel\Core\File_Area | null $area) : \Fuel\Core\IO | string
string
file to read
bool
whether to use readfile() or file_get_contents()
\FileAccessException |
|
---|---|
\InvalidPathException |
|
\OutsideAreaException |
\Fuel\Core\IO
string
file contentsread_dir(string $path, int $depth, Array | null $filter, string | \Fuel\Core\File_Area | null $area) : array
string
directory to read
int
depth to recurse directory, 1 is only current and 0 or smaller is unlimited
Array
null
array of partial regexps or non-array for default
\FileAccessException |
|
---|---|
\InvalidPathException |
|
\OutsideAreaException |
array
rename(string $path, string $new_path, string | \Fuel\Core\File_Area | null $source_area, string | \Fuel\Core\File_Area | null $target_area) : bool
string
path to file or directory to rename
string
new path (full path, can also cause move)
string
\Fuel\Core\File_Area
null
source path file area name, object or null for non-specific
string
\Fuel\Core\File_Area
null
target path file area name, object or null for non-specific. Defaults to source_area if not set.
\FileAccessException |
|
---|---|
\OutsideAreaException |
bool
rename_dir(string $path, string $new_path, string | \Fuel\Core\File_Area | null $source_area, string | \Fuel\Core\File_Area | null $target_area) : bool
string
path to directory to rename
string
new path (full path, can also cause move)
string
\Fuel\Core\File_Area
null
source path file area name, object or null for non-specific
string
\Fuel\Core\File_Area
null
target path file area name, object or null for non-specific. Defaults to source_area if not set.
\FileAccessException |
|
---|---|
\OutsideAreaException |
bool
symlink(string $path, string $link_path, bool $is_file, string | \Fuel\Core\File_Area | null $area) : bool
string
target of symlink
string
destination of symlink
bool
true for file, false for directory
\FileAccessException |
|
---|---|
\InvalidPathException |
|
\OutsideAreaException |
bool
update(string $basepath, string $name, string $contents, string | \Fuel\Core\File_Area | null $area) : bool
string
directory where to write the file
string
filename
string
contents of file
\InvalidPathException |
|
---|---|
\FileAccessException |
|
\OutsideAreaException |
bool
$areas : array