PHP Класс PMA\libraries\File

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$_charset charset of file
$_chunk_size size of chunk to read with every step
$_compression type of compression
$_content the content
$_decompress whether to decompress content before returning
$_error_message the error message
$_handle file handle
$_is_temp whether the file is temporary or not
$_name the temporary file name
$_offset integer

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

Метод Описание
__construct ( boolean | string $name = false ) constructor
__destruct ( ) destructor
checkTblChangeForm ( string $key, string $rownumber ) : boolean checks the superglobals provided if the tbl_change form is submitted and uses the submitted/selected file
checkUploadedFile ( ) : boolean If we are on a server with open_basedir, we must move the file before opening it. The FAQ 1.11 explains how to create the "./tmp" directory - if needed
cleanUp ( ) : boolean deletes file if it is temporary, usually from a moved upload file
close ( ) : void Closes the file
delete ( ) : boolean deletes the file
eof ( ) : boolean Checks whether we've reached end of file
errorUnsupported ( ) : void Sets error message for unsupported compression.
fetchUploadedFromTblChangeRequestMultiple ( array $file, string $rownumber, string $key ) : array strips some dimension from the multi-dimensional array from $_FILES
getCharset ( ) : string Returns the character set of the file
getChunkSize ( ) : integer Returns the chunk size
getCompression ( ) : string Returns compression used by file.
getContent ( ) : string | false Gets file content
getContentLength ( ) : integer Returns the length of the content in the file
getError ( ) : Message | null Returns possible error message.
getHandle ( ) : resource Returns the file handle
getName ( ) : string accessor
getOffset ( ) : integer Returns the offset
getRawContent ( ) : string | false Gets file content
isError ( ) : boolean Checks whether there was any error.
isReadable ( ) : boolean Checks whether file can be read.
isTemp ( boolean $is_temp = null ) : boolean checks or sets the temp flag for this file file objects with temp flags are deleted with object destruction
isUploaded ( ) : boolean Whether file is uploaded.
open ( ) : boolean Attempts to open the file.
openZip ( string | null $specific_entry = null ) : boolean Opens file from zip
read ( integer $size ) : string Reads data from file
setCharset ( string $charset ) : void Sets the character set of the file
setChunkSize ( integer $chunk_size ) : void Sets the chunk size
setDecompressContent ( boolean $decompress ) : void Sets whether the content should be decompressed before returned
setHandle ( object $handle ) : void Sets the file handle
setLocalSelectedFile ( string $name ) : boolean Sets named file to be read from UploadDir.
setName ( string $name ) : void accessor
setSelectedFromTblChangeRequest ( string $key, string $rownumber = null ) : boolean sets the name if the file to the one selected in the tbl_change form
setUploadedFile ( string $name ) : boolean Initializes object from uploaded file.
setUploadedFromTblChangeRequest ( string $key, string $rownumber ) : boolean Loads uploaded file from table change request.

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

Метод Описание
detectCompression ( ) : string | false Detects what compression the file uses

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

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

constructor
public __construct ( boolean | string $name = false )
$name boolean | string file name or false

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

destructor
См. также: File::cleanUp()
public __destruct ( )

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

checks the superglobals provided if the tbl_change form is submitted and uses the submitted/selected file
public checkTblChangeForm ( string $key, string $rownumber ) : boolean
$key string the md5 hash of the column name
$rownumber string number of row to process
Результат boolean success

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

If we are on a server with open_basedir, we must move the file before opening it. The FAQ 1.11 explains how to create the "./tmp" directory - if needed
public checkUploadedFile ( ) : boolean
Результат boolean whether uploaded file is fine or not

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

deletes file if it is temporary, usually from a moved upload file
public cleanUp ( ) : boolean
Результат boolean success

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

Closes the file
public close ( ) : void
Результат void

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

deletes the file
public delete ( ) : boolean
Результат boolean success

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

Detects what compression the file uses
protected detectCompression ( ) : string | false
Результат string | false false on error, otherwise string MIME type of compression, none for none

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

Checks whether we've reached end of file
public eof ( ) : boolean
Результат boolean

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

Sets error message for unsupported compression.
public errorUnsupported ( ) : void
Результат void

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

$file['name']['multi_edit'][$rownumber][$key] = [value] $file['type']['multi_edit'][$rownumber][$key] = [value] $file['size']['multi_edit'][$rownumber][$key] = [value] $file['tmp_name']['multi_edit'][$rownumber][$key] = [value] $file['error']['multi_edit'][$rownumber][$key] = [value] becomes: $file['name'] = [value] $file['type'] = [value] $file['size'] = [value] $file['tmp_name'] = [value] $file['error'] = [value]
public fetchUploadedFromTblChangeRequestMultiple ( array $file, string $rownumber, string $key ) : array
$file array the array
$rownumber string number of row to process
$key string key to process
Результат array

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

Returns the character set of the file
public getCharset ( ) : string
Результат string character set of the file

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

Returns the chunk size
public getChunkSize ( ) : integer
Результат integer the chunk size

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

Returns compression used by file.
public getCompression ( ) : string
Результат string MIME type of compression, none for none

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

Gets file content
public getContent ( ) : string | false
Результат string | false the binary file content as a string, or false if no content

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

Returns the length of the content in the file
public getContentLength ( ) : integer
Результат integer the length of the file content

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

Returns possible error message.
public getError ( ) : Message | null
Результат Message | null error message

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

Returns the file handle
public getHandle ( ) : resource
Результат resource file handle

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

accessor
public getName ( ) : string
Результат string File::$_name

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

Returns the offset
public getOffset ( ) : integer
Результат integer the offset

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

Gets file content
public getRawContent ( ) : string | false
Результат string | false the binary file content, or false if no content

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

Checks whether there was any error.
public isError ( ) : boolean
Результат boolean whether an error occurred or not

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

Checks whether file can be read.
public isReadable ( ) : boolean
Результат boolean whether the file is readable or not

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

checks or sets the temp flag for this file file objects with temp flags are deleted with object destruction
public isTemp ( boolean $is_temp = null ) : boolean
$is_temp boolean sets the temp flag
Результат boolean File::$_is_temp

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

Whether file is uploaded.
public isUploaded ( ) : boolean
Результат boolean

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

Attempts to open the file.
public open ( ) : boolean
Результат boolean

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

Opens file from zip
public openZip ( string | null $specific_entry = null ) : boolean
$specific_entry string | null Entry to open
Результат boolean

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

Reads data from file
public read ( integer $size ) : string
$size integer Number of bytes to read
Результат string

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

Sets the character set of the file
public setCharset ( string $charset ) : void
$charset string character set of the file
Результат void

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

Sets the chunk size
public setChunkSize ( integer $chunk_size ) : void
$chunk_size integer the chunk size
Результат void

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

Sets whether the content should be decompressed before returned
public setDecompressContent ( boolean $decompress ) : void
$decompress boolean whether to decompress
Результат void

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

Sets the file handle
public setHandle ( object $handle ) : void
$handle object file handle
Результат void

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

Sets named file to be read from UploadDir.
public setLocalSelectedFile ( string $name ) : boolean
$name string file name
Результат boolean success

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

accessor
public setName ( string $name ) : void
$name string file name
Результат void

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

sets the name if the file to the one selected in the tbl_change form
public setSelectedFromTblChangeRequest ( string $key, string $rownumber = null ) : boolean
$key string the md5 hash of the column name
$rownumber string number of row to process
Результат boolean success

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

Initializes object from uploaded file.
public setUploadedFile ( string $name ) : boolean
$name string name of file uploaded
Результат boolean success

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

Loads uploaded file from table change request.
public setUploadedFromTblChangeRequest ( string $key, string $rownumber ) : boolean
$key string the md5 hash of the column name
$rownumber string number of row to process
Результат boolean success

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

$_charset публичное свойство

charset of file
public $_charset

$_chunk_size публичное свойство

size of chunk to read with every step
public $_chunk_size

$_compression публичное свойство

type of compression
public $_compression

$_content публичное свойство

the content
public $_content

$_decompress публичное свойство

whether to decompress content before returning
public $_decompress

$_error_message публичное свойство

the error message
public $_error_message

$_handle публичное свойство

file handle
public $_handle

$_is_temp публичное свойство

whether the file is temporary or not
public $_is_temp

$_name публичное свойство

the temporary file name
public $_name

$_offset публичное свойство

public int $_offset
Результат integer