final class File (View source)

File wrapper class

when uploading a file into a blob field, should we also consider using chunks like in import? UPDATE `table` SET `field` = `field` + [chunk]

Methods

__construct(string|null $name = null)

No description

__destruct()

destructor

bool
cleanUp()

deletes file if it is temporary, usually from a moved upload file

string|false
getRawContent()

Gets file content

string|false
getContent()

Gets file content

bool
isUploaded()

Whether file is uploaded.

bool
setUploadedFile(string $name)

Initializes object from uploaded file.

bool
setUploadedFromTblChangeRequest(string $key, string $rownumber)

Loads uploaded file from table change request.

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
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

void
setDecompressContent(bool $decompress)

Sets whether the content should be decompressed before returned

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
getCompression()

Returns compression used by file.

Details

__construct(string|null $name = null)

No description

Parameters

string|null $name

__destruct()

destructor

See also

File::cleanUp

bool cleanUp()

deletes file if it is temporary, usually from a moved upload file

Return Value

bool

string|false getRawContent()

Gets file content

Return Value

string|false

the binary file content, or false if no content

string|false getContent()

Gets file content

Return Value

string|false

the binary file content as a string, or false if no content

bool isUploaded()

Whether file is uploaded.

Return Value

bool

bool setUploadedFile(string $name)

Initializes object from uploaded file.

Parameters

string $name

name of file uploaded

Return Value

bool

bool setUploadedFromTblChangeRequest(string $key, string $rownumber)

Loads uploaded file from table change request.

Parameters

string $key

the md5 hash of the column name

string $rownumber

number of row to process

Return Value

bool

bool setSelectedFromTblChangeRequest(string $key, string|null $rownumber = null)

sets the name if the file to the one selected in the tbl_change form

Parameters

string $key

the md5 hash of the column name

string|null $rownumber

number of row to process

Return Value

bool

Message|null getError()

Returns possible error message.

Return Value

Message|null

error message

bool checkTblChangeForm(string $key, string $rownumber)

checks the superglobals provided if the tbl_change form is submitted and uses the submitted/selected file

Parameters

string $key

the md5 hash of the column name

string $rownumber

number of row to process

Return Value

bool

bool setLocalSelectedFile(string $name)

Sets named file to be read from UploadDir.

Parameters

string $name

file name

Return Value

bool

bool isReadable()

Checks whether file can be read.

Return Value

bool

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

move check of $cfg['TempDir'] into Config?

Return Value

bool

void setDecompressContent(bool $decompress)

Sets whether the content should be decompressed before returned

Parameters

bool $decompress

whether to decompress

Return Value

void

void errorUnsupported()

Sets error message for unsupported compression.

Return Value

void

bool open()

Attempts to open the file.

Return Value

bool

bool openZip(string|null $specificEntry = null)

Opens file from zip

Parameters

string|null $specificEntry

Entry to open

Return Value

bool

bool eof()

Checks whether we've reached end of file

Return Value

bool

void close()

Closes the file

Return Value

void

string read(int $size)

Reads data from file

Parameters

int $size

Number of bytes to read

Return Value

string

string getCompression()

Returns compression used by file.

Return Value

string

MIME type of compression, none for none