PHP Class PMA\libraries\File

Afficher le fichier Open project: phpmyadmin/phpmyadmin Class Usage Examples

Méthodes publiques

Свойство Type Description
$_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

Méthodes publiques

Méthode Description
__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.

Méthodes protégées

Méthode Description
detectCompression ( ) : string | false Detects what compression the file uses

Method Details

__construct() public méthode

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

__destruct() public méthode

destructor
See also: File::cleanUp()
public __destruct ( )

checkTblChangeForm() public méthode

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
Résultat boolean success

checkUploadedFile() public méthode

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
Résultat boolean whether uploaded file is fine or not

cleanUp() public méthode

deletes file if it is temporary, usually from a moved upload file
public cleanUp ( ) : boolean
Résultat boolean success

close() public méthode

Closes the file
public close ( ) : void
Résultat void

delete() public méthode

deletes the file
public delete ( ) : boolean
Résultat boolean success

detectCompression() protected méthode

Detects what compression the file uses
protected detectCompression ( ) : string | false
Résultat string | false false on error, otherwise string MIME type of compression, none for none

eof() public méthode

Checks whether we've reached end of file
public eof ( ) : boolean
Résultat boolean

errorUnsupported() public méthode

Sets error message for unsupported compression.
public errorUnsupported ( ) : void
Résultat void

fetchUploadedFromTblChangeRequestMultiple() public méthode

$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
Résultat array

getCharset() public méthode

Returns the character set of the file
public getCharset ( ) : string
Résultat string character set of the file

getChunkSize() public méthode

Returns the chunk size
public getChunkSize ( ) : integer
Résultat integer the chunk size

getCompression() public méthode

Returns compression used by file.
public getCompression ( ) : string
Résultat string MIME type of compression, none for none

getContent() public méthode

Gets file content
public getContent ( ) : string | false
Résultat string | false the binary file content as a string, or false if no content

getContentLength() public méthode

Returns the length of the content in the file
public getContentLength ( ) : integer
Résultat integer the length of the file content

getError() public méthode

Returns possible error message.
public getError ( ) : Message | null
Résultat Message | null error message

getHandle() public méthode

Returns the file handle
public getHandle ( ) : resource
Résultat resource file handle

getName() public méthode

accessor
public getName ( ) : string
Résultat string File::$_name

getOffset() public méthode

Returns the offset
public getOffset ( ) : integer
Résultat integer the offset

getRawContent() public méthode

Gets file content
public getRawContent ( ) : string | false
Résultat string | false the binary file content, or false if no content

isError() public méthode

Checks whether there was any error.
public isError ( ) : boolean
Résultat boolean whether an error occurred or not

isReadable() public méthode

Checks whether file can be read.
public isReadable ( ) : boolean
Résultat boolean whether the file is readable or not

isTemp() public méthode

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
Résultat boolean File::$_is_temp

isUploaded() public méthode

Whether file is uploaded.
public isUploaded ( ) : boolean
Résultat boolean

open() public méthode

Attempts to open the file.
public open ( ) : boolean
Résultat boolean

openZip() public méthode

Opens file from zip
public openZip ( string | null $specific_entry = null ) : boolean
$specific_entry string | null Entry to open
Résultat boolean

read() public méthode

Reads data from file
public read ( integer $size ) : string
$size integer Number of bytes to read
Résultat string

setCharset() public méthode

Sets the character set of the file
public setCharset ( string $charset ) : void
$charset string character set of the file
Résultat void

setChunkSize() public méthode

Sets the chunk size
public setChunkSize ( integer $chunk_size ) : void
$chunk_size integer the chunk size
Résultat void

setDecompressContent() public méthode

Sets whether the content should be decompressed before returned
public setDecompressContent ( boolean $decompress ) : void
$decompress boolean whether to decompress
Résultat void

setHandle() public méthode

Sets the file handle
public setHandle ( object $handle ) : void
$handle object file handle
Résultat void

setLocalSelectedFile() public méthode

Sets named file to be read from UploadDir.
public setLocalSelectedFile ( string $name ) : boolean
$name string file name
Résultat boolean success

setName() public méthode

accessor
public setName ( string $name ) : void
$name string file name
Résultat void

setSelectedFromTblChangeRequest() public méthode

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
Résultat boolean success

setUploadedFile() public méthode

Initializes object from uploaded file.
public setUploadedFile ( string $name ) : boolean
$name string name of file uploaded
Résultat boolean success

setUploadedFromTblChangeRequest() public méthode

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
Résultat boolean success

Property Details

$_charset public_oe property

charset of file
public $_charset

$_chunk_size public_oe property

size of chunk to read with every step
public $_chunk_size

$_compression public_oe property

type of compression
public $_compression

$_content public_oe property

the content
public $_content

$_decompress public_oe property

whether to decompress content before returning
public $_decompress

$_error_message public_oe property

the error message
public $_error_message

$_handle public_oe property

file handle
public $_handle

$_is_temp public_oe property

whether the file is temporary or not
public $_is_temp

$_name public_oe property

the temporary file name
public $_name

$_offset public_oe property

public int $_offset
Résultat integer