PHP 클래스 ElggFile, Elgg

저자: Curverider Ltd
상속: extends ElggObject
파일 보기 프로젝트 열기: elgg/elgg 1 사용 예제들

공개 메소드들

메소드 설명
__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