LDAP Account Manager

LamTemporaryFilesManager
in package

Manages temporary files.

Table of Contents

SESSION_KEY  = 'sec_registered_tmp_files'
deleteAllRegisteredFiles()  : void
Deletes all registered files of the user.
getDownloadLink()  : string
Returns the download link to a file.
getFileSystemPath()  : string
Returns the raw path on file system.
getResourceLink()  : string
Returns the plain link to a file.
isRegisteredFile()  : bool
Checks if the given file name is valid and registered.
openTemporaryFileForRead()  : resource
Opens a temporary file for reading.
openTemporaryFileForWrite()  : resource
Opens a temporary file for writing.
registerTemporaryFile()  : string
Creates a temporary file and registers it for the current session.
isValidFileName()  : bool
Checks if the given file name contains no special characters.

Constants

SESSION_KEY

public mixed SESSION_KEY = 'sec_registered_tmp_files'

Methods

deleteAllRegisteredFiles()

Deletes all registered files of the user.

public deleteAllRegisteredFiles() : void
Return values
void

Returns the download link to a file.

public getDownloadLink(string $fileName[, string $prefix = '../' ]) : string
Parameters
$fileName : string

file name

$prefix : string = '../'

prefix to folder "templates" (e.g. "../../" if called from templates/config/sub, default: "../")

Tags
throws
LAMException

error reading file

Return values
string

download link

getFileSystemPath()

Returns the raw path on file system.

public getFileSystemPath(string $fileName) : string

Only to be used if download/resource link cannot be used.

Parameters
$fileName : string

file name

Tags
throws
LAMException
Return values
string

path on file system

Returns the plain link to a file.

public getResourceLink(string $fileName[, string $prefix = '../' ]) : string
Parameters
$fileName : string

file name

$prefix : string = '../'

prefix to folder "templates" (e.g. "../../" if called from templates/config/sub, default: "../")

Tags
throws
LAMException

error reading file

Return values
string

download link

isRegisteredFile()

Checks if the given file name is valid and registered.

public isRegisteredFile(string $fileName) : bool
Parameters
$fileName : string

file name

Return values
bool

is valid

openTemporaryFileForRead()

Opens a temporary file for reading.

public openTemporaryFileForRead(string $fileName) : resource
Parameters
$fileName : string

file name

Tags
throws
LAMException

unable to open file

Return values
resource

file handle

openTemporaryFileForWrite()

Opens a temporary file for writing.

public openTemporaryFileForWrite(string $fileName) : resource
Parameters
$fileName : string

file name

Tags
throws
LAMException

unable to open file

Return values
resource

file handle

registerTemporaryFile()

Creates a temporary file and registers it for the current session.

public registerTemporaryFile(string $extension[, string $prefix = '' ]) : string
Parameters
$extension : string

file extension (including ".", e.g. ".svg")

$prefix : string = ''

file prefix (default: empty)

Tags
throws
LAMException

unable to create temporary file

Return values
string

file name

isValidFileName()

Checks if the given file name contains no special characters.

private isValidFileName(string $fileName) : bool
Parameters
$fileName : string

file name

Return values
bool

is valid

Search results