PHP Класс Pop\File\File

Автор: Nick Sagona, III ([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$allowed array Array of allowed file types.
$basename string Full basename of file, i.e. 'file.ext'
$dir string Full, absolute directory of file, i.e. '/some/dir/'
$ext string File extension, i.e. 'ext'
$filename string Full filename of file, i.e. 'file'
$fullpath string Full path and name of the file, i.e. '/some/dir/file.ext'
$mime string File mime type
$output string File output data.
$size integer File size in bytes

Открытые методы

Метод Описание
__construct ( string $file, array $types = null ) : File Constructor
addAllowedTypes ( array $types ) : void Set the allowed files types.
append ( string $data ) : File Append data to a file.
checkDupe ( string $file, string $dir = null ) : string Static method to check for a duplicate file, returning the next incremented filename, i.e. filename_1.txt
copy ( string $new, boolean $overwrite = false ) : File Copy the file object directly to another file on disk.
delete ( ) : void Delete the file object directly from disk.
getAllowedTypes ( ) : array Get the current allowed files types.
getBasename ( ) : string Get the basename.
getDir ( ) : string Get the directory.
getDirGroup ( ) : array Get the owner of the file. Works on POSIX file systems only
getDirOwner ( ) : array Get the owner of the file. Works on POSIX file systems only
getDirPermissions ( ) : string Get the permissions of the directory the file is in.
getExt ( ) : string Get the extension.
getFilename ( ) : string Get the filename.
getFullpath ( ) : string Get the fullpath.
getGroup ( ) : array Get the owner of the file. Works on POSIX file systems only
getMime ( ) : string Get the current file mime type.
getOwner ( ) : array Get the owner of the file. Works on POSIX file systems only
getPermissions ( ) : string Get the permissions of the file.
getSize ( ) : string Get the current file size.
getUser ( ) : array Get current user. Works on POSIX file systems only
isAllowed ( string $type ) : boolean Test if a certain file type is allowed.
isDir ( ) : boolean Is dir object.
isFile ( ) : boolean Is file object.
move ( string $new, boolean $overwrite = false ) : File Move the file object directly to another location on disk.
output ( boolean $download = false ) : File Output the file object directly.
read ( integer | string $off = null, integer | string $len = null ) : string Read data from a file.
save ( string $to = null, boolean $append = false ) : File Save the file object to disk.
setAllowedTypes ( array $types = null ) : void Set the allowed files types, overriding any previously allowed types.
setDirPermissions ( mixed $mode ) : File Change the permissions of the directory the file is in.
setMime ( string $mime ) : File Set the file mime type.
setPermissions ( mixed $mode ) : File Change the permissions of the file.
upload ( string $upload, string $file, integer $size, array $types = null ) : File Static method to upload a file and return a file object.
write ( string $data, boolean $append = false ) : File Write data to a file.

Защищенные методы

Метод Описание
setFile ( string $file, array $types = null ) : void Set the file and its properties.

Описание методов

__construct() публичный Метод

Instantiate the file object, either from a file on disk or as a new file.
public __construct ( string $file, array $types = null ) : File
$file string
$types array
Результат File

addAllowedTypes() публичный Метод

Set the allowed files types.
public addAllowedTypes ( array $types ) : void
$types array
Результат void

append() публичный Метод

Append data to a file.
public append ( string $data ) : File
$data string
Результат File

checkDupe() публичный статический Метод

Static method to check for a duplicate file, returning the next incremented filename, i.e. filename_1.txt
public static checkDupe ( string $file, string $dir = null ) : string
$file string
$dir string
Результат string

copy() публичный Метод

Copy the file object directly to another file on disk.
public copy ( string $new, boolean $overwrite = false ) : File
$new string
$overwrite boolean
Результат File

delete() публичный Метод

Delete the file object directly from disk.
public delete ( ) : void
Результат void

getAllowedTypes() публичный Метод

Get the current allowed files types.
public getAllowedTypes ( ) : array
Результат array

getBasename() публичный Метод

Get the basename.
public getBasename ( ) : string
Результат string

getDir() публичный Метод

Get the directory.
public getDir ( ) : string
Результат string

getDirGroup() публичный Метод

Get the owner of the file. Works on POSIX file systems only
public getDirGroup ( ) : array
Результат array

getDirOwner() публичный Метод

Get the owner of the file. Works on POSIX file systems only
public getDirOwner ( ) : array
Результат array

getDirPermissions() публичный Метод

Get the permissions of the directory the file is in.
public getDirPermissions ( ) : string
Результат string

getExt() публичный Метод

Get the extension.
public getExt ( ) : string
Результат string

getFilename() публичный Метод

Get the filename.
public getFilename ( ) : string
Результат string

getFullpath() публичный Метод

Get the fullpath.
public getFullpath ( ) : string
Результат string

getGroup() публичный Метод

Get the owner of the file. Works on POSIX file systems only
public getGroup ( ) : array
Результат array

getMime() публичный Метод

Get the current file mime type.
public getMime ( ) : string
Результат string

getOwner() публичный Метод

Get the owner of the file. Works on POSIX file systems only
public getOwner ( ) : array
Результат array

getPermissions() публичный Метод

Get the permissions of the file.
public getPermissions ( ) : string
Результат string

getSize() публичный Метод

Get the current file size.
public getSize ( ) : string
Результат string

getUser() публичный Метод

Get current user. Works on POSIX file systems only
public getUser ( ) : array
Результат array

isAllowed() публичный Метод

Test if a certain file type is allowed.
public isAllowed ( string $type ) : boolean
$type string
Результат boolean

isDir() публичный Метод

Is dir object.
public isDir ( ) : boolean
Результат boolean

isFile() публичный Метод

Is file object.
public isFile ( ) : boolean
Результат boolean

move() публичный Метод

Move the file object directly to another location on disk.
public move ( string $new, boolean $overwrite = false ) : File
$new string
$overwrite boolean
Результат File

output() публичный Метод

Output the file object directly.
public output ( boolean $download = false ) : File
$download boolean
Результат File

read() публичный Метод

Read data from a file.
public read ( integer | string $off = null, integer | string $len = null ) : string
$off integer | string
$len integer | string
Результат string

save() публичный Метод

Save the file object to disk.
public save ( string $to = null, boolean $append = false ) : File
$to string
$append boolean
Результат File

setAllowedTypes() публичный Метод

Set the allowed files types, overriding any previously allowed types.
public setAllowedTypes ( array $types = null ) : void
$types array
Результат void

setDirPermissions() публичный Метод

Change the permissions of the directory the file is in.
public setDirPermissions ( mixed $mode ) : File
$mode mixed
Результат File

setFile() защищенный Метод

Set the file and its properties.
protected setFile ( string $file, array $types = null ) : void
$file string
$types array
Результат void

setMime() публичный Метод

Set the file mime type.
public setMime ( string $mime ) : File
$mime string
Результат File

setPermissions() публичный Метод

Change the permissions of the file.
public setPermissions ( mixed $mode ) : File
$mode mixed
Результат File

upload() публичный статический Метод

Static method to upload a file and return a file object.
public static upload ( string $upload, string $file, integer $size, array $types = null ) : File
$upload string
$file string
$size integer
$types array
Результат File

write() публичный Метод

Write data to a file.
public write ( string $data, boolean $append = false ) : File
$data string
$append boolean
Результат File

Описание свойств

$allowed защищенное свойство

Array of allowed file types.
protected array $allowed
Результат array

$basename защищенное свойство

Full basename of file, i.e. 'file.ext'
protected string $basename
Результат string

$dir защищенное свойство

Full, absolute directory of file, i.e. '/some/dir/'
protected string $dir
Результат string

$ext защищенное свойство

File extension, i.e. 'ext'
protected string $ext
Результат string

$filename защищенное свойство

Full filename of file, i.e. 'file'
protected string $filename
Результат string

$fullpath защищенное свойство

Full path and name of the file, i.e. '/some/dir/file.ext'
protected string $fullpath
Результат string

$mime защищенное свойство

File mime type
protected string $mime
Результат string

$output защищенное свойство

File output data.
protected string $output
Результат string

$size защищенное свойство

File size in bytes
protected int $size
Результат integer