PHP Класс ElggFile, Elgg

Автор: Curverider Ltd
Наследование: extends ElggObject
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
__sleep ( ) : string[] Get property names to serialize.
acceptUploadedFile ( Symfony\Component\HttpFoundation\File\UploadedFile $upload ) : boolean Writes contents of the uploaded file to an instance of ElggFile
close ( ) : boolean Close the file and commit changes
delete ( boolean $follow_symlinks = true ) : boolean Delete this file.
detectMimeType ( mixed $file = null, mixed $default = null ) : mixed Detects mime types based on filename or actual file.
eof ( ) : boolean Return a boolean value whether the file handle is at the end of the file
exists ( ) : boolean Returns if the file exists
getFilename ( ) : string Return the filename.
getFilenameOnFilestore ( ) : string Return the filename of this file as it is/will be stored on the filestore, which may be different to the filename.
getFilestoreSize ( string $prefix = '', integer $container_guid ) : integer Return the size of the filestore associated with this file
getMimeType ( ) : string Get the mime type of the file.
getModifiedTime ( ) : integer Returns file modification time
getSimpleType ( ) : string Get the simple type of the file.
getSize ( ) : integer Return the size of the file in bytes.
grabFile ( ) : mixed Gets the full contents of this file.
open ( string $mode ) : resource Open the file with the given mode
read ( integer $length, integer $offset ) : mixed Read data.
seek ( integer $position ) : void Seek a position in the file.
setDescription ( string $description ) : boolean Set the optional file description.
setFilename ( string $name ) : void Set the filename of this file.
setMimeType ( string $mimetype ) : boolean Set the mime type of the file.
setModifiedTime ( ) : boolean Updates modification time of the file and clears stats cache for the file
tell ( ) : integer Return the current position of the file.
transfer ( integer $owner_guid, string $filename = null ) : boolean Transfer a file to a new owner and sets a new filename, copies file contents to a new location.
write ( string $data ) : boolean Write data.

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

Метод Описание
getFilestore ( ) : ElggDiskFilestore Return the system filestore based on dataroot.
initializeAttributes ( ) : void Set subtype to 'file'.

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

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

Get property names to serialize.
public __sleep ( ) : string[]
Результат string[]

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

Writes contents of the uploaded file to an instance of ElggFile
public acceptUploadedFile ( Symfony\Component\HttpFoundation\File\UploadedFile $upload ) : boolean
$upload Symfony\Component\HttpFoundation\File\UploadedFile Uploaded file object
Результат boolean

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

Close the file and commit changes
public close ( ) : boolean
Результат boolean

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

Delete this file.
public delete ( boolean $follow_symlinks = true ) : boolean
$follow_symlinks boolean If true, will also delete the target file if the current file is a symlink
Результат boolean

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

Detects mime types based on filename or actual file.
С версии: 1.7.12
public detectMimeType ( mixed $file = null, mixed $default = null ) : mixed
$file mixed The full path of the file to check. For uploaded files, use tmp_name.
$default mixed A default. Useful to pass what the browser thinks it is.
Результат mixed Detected type on success, false on failure.

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

Return a boolean value whether the file handle is at the end of the file
public eof ( ) : boolean
Результат boolean

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

Returns if the file exists
public exists ( ) : boolean
Результат boolean

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

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

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

Return the filename of this file as it is/will be stored on the filestore, which may be different to the filename.
public getFilenameOnFilestore ( ) : string
Результат string

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

Return the system filestore based on dataroot.
protected getFilestore ( ) : ElggDiskFilestore
Результат ElggDiskFilestore

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

Return the size of the filestore associated with this file
public getFilestoreSize ( string $prefix = '', integer $container_guid ) : integer
$prefix string Storage prefix
$container_guid integer The container GUID of the checked filestore
Результат integer

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

Returns mimetype metadata value if set, otherwise attempts to detect it.
public getMimeType ( ) : string
Результат string

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

Returns file modification time
public getModifiedTime ( ) : integer
Результат integer

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

Returns simpletype metadata value if set, otherwise parses it from mimetype
См. также: elgg_get_file_simple_type
public getSimpleType ( ) : string
Результат string 'document', 'audio', 'video', or 'general' if the MIME type was unrecognized

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

Return the size of the file in bytes.
С версии: 1.9
public getSize ( ) : integer
Результат integer

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

Gets the full contents of this file.
public grabFile ( ) : mixed
Результат mixed The file contents.

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

Set subtype to 'file'.
protected initializeAttributes ( ) : void
Результат void

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

Open the file with the given mode
public open ( string $mode ) : resource
$mode string Either read/write/append
Результат resource File handler

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

Read data.
public read ( integer $length, integer $offset ) : mixed
$length integer Amount to read.
$offset integer The offset to start from.
Результат mixed Data or false

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

Seek a position in the file.
public seek ( integer $position ) : void
$position integer Position in bytes
Результат void

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

Set the optional file description.
public setDescription ( string $description ) : boolean
$description string The description.
Результат boolean

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

Set the filename of this file.
public setFilename ( string $name ) : void
$name string The filename.
Результат void

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

Set the mime type of the file.
public setMimeType ( string $mimetype ) : boolean
$mimetype string The mimetype
Результат boolean

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

Updates modification time of the file and clears stats cache for the file
public setModifiedTime ( ) : boolean
Результат boolean

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

Return the current position of the file.
public tell ( ) : integer
Результат integer The file position

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

This is an alternative to using rename() which fails to move files to a non-existent directory under new owner's filestore directory
public transfer ( integer $owner_guid, string $filename = null ) : boolean
$owner_guid integer New owner's guid
$filename string New filename (uses old filename if not set)
Результат boolean

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

Write data.
public write ( string $data ) : boolean
$data string The data
Результат boolean