File
class File (View source)
File wrapper class
Properties
protected string|null | $name | ||
protected string|null | $content | ||
protected Message|null | $errorMessage | ||
protected bool | $isTemp | ||
protected string|null | $compression | ||
protected int | $offset | ||
protected int | $chunkSize | ||
protected resource|null | $handle | ||
protected bool | $decompress | ||
protected string | $charset |
Methods
No description
destructor
deletes file if it is temporary, usually from a moved upload file
deletes the file
checks or sets the temp flag for this file file objects with temp flags are deleted with object destruction
accessor
Gets file content
Gets file content
Whether file is uploaded.
accessor
Initializes object from uploaded file.
Loads uploaded file from table change request.
strips some dimension from the multi-dimensional array from $_FILES
sets the name if the file to the one selected in the tbl_change form
Returns possible error message.
Checks whether there was any error.
checks the superglobals provided if the tbl_change form is submitted and uses the submitted/selected file
Sets named file to be read from UploadDir.
Checks whether file can be read.
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
Detects what compression the file uses
Sets whether the content should be decompressed before returned
Returns the file handle
Sets the file handle
Sets error message for unsupported compression.
Attempts to open the file.
Opens file from zip
Checks whether we've reached end of file
Closes the file
Reads data from file
Returns the character set of the file
Sets the character set of the file
Returns compression used by file.
Returns the offset
Returns the chunk size
Sets the chunk size
Returns the length of the content in the file
Details
__construct(bool|string $name = false)
No description
__destruct()
destructor
bool
cleanUp()
deletes file if it is temporary, usually from a moved upload file
bool
delete()
deletes the file
bool
isTemp(bool|null $isTemp = null)
checks or sets the temp flag for this file file objects with temp flags are deleted with object destruction
void
setName(string|null $name)
accessor
string|false
getRawContent()
Gets file content
string|false
getContent()
Gets file content
bool
isUploaded()
Whether file is uploaded.
string|null
getName()
accessor
bool
setUploadedFile(string $name)
Initializes object from uploaded file.
bool
setUploadedFromTblChangeRequest(string $key, string $rownumber)
Loads uploaded file from table change request.
array
fetchUploadedFromTblChangeRequestMultiple(array $file, string $rownumber, string $key)
strips some dimension from the multi-dimensional array from $_FILES
$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]
bool
setSelectedFromTblChangeRequest(string $key, string|null $rownumber = null)
sets the name if the file to the one selected in the tbl_change form
Message|null
getError()
Returns possible error message.
bool
isError()
Checks whether there was any error.
bool
checkTblChangeForm(string $key, string $rownumber)
checks the superglobals provided if the tbl_change form is submitted and uses the submitted/selected file
bool
setLocalSelectedFile(string $name)
Sets named file to be read from UploadDir.
bool
isReadable()
Checks whether file can be read.
bool
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
protected string|false
detectCompression()
Detects what compression the file uses
void
setDecompressContent(bool $decompress)
Sets whether the content should be decompressed before returned
resource|null
getHandle()
Returns the file handle
void
setHandle(resource $handle)
Sets the file handle
void
errorUnsupported()
Sets error message for unsupported compression.
bool
open()
Attempts to open the file.
bool
openZip(string|null $specificEntry = null)
Opens file from zip
bool
eof()
Checks whether we've reached end of file
void
close()
Closes the file
string
read(int $size)
Reads data from file
string
getCharset()
Returns the character set of the file
void
setCharset(string $charset)
Sets the character set of the file
string
getCompression()
Returns compression used by file.
int
getOffset()
Returns the offset
int
getChunkSize()
Returns the chunk size
void
setChunkSize(int $chunkSize)
Sets the chunk size
int
getContentLength()
Returns the length of the content in the file