lib/ezfile/classes/ezfile.php
File containing the eZFile class.
- Copyright
- Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.
- License
- eZ Business Use License Agreement Version 2.0
- Package
- lib
- Version
- 4.6.0
\eZFile
File containing the eZFile class.
- Copyright
- Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.
- License
- eZ Business Use License Agreement Version 2.0
- Version
- 4.6.0
Constants
Methods


create(
$filename, $directory
=
false, $data
=
false, $atomic
=
false
)
:
void
Name | Type | Description |
---|---|---|
$filename | ||
$directory | ||
$data | ||
$atomic |


download(
string $file, bool $isAttachedDownload
=
true, string $overrideFilename
=
false, int $startOffset
=
0, int $length
=
false
)
:
bool
Prepares a file for Download and terminates the execution.
This method will: - empty the output buffer - stop buffering - stop the active session (in order to allow concurrent browsing while downloading)
Name | Type | Description |
---|---|---|
$file | string | Path to the local file |
$isAttachedDownload | bool | Determines weather to download the file as an attachment ( download popup box ) or not. |
$overrideFilename | string | |
$startOffset | int | Offset to start transfer from, in bytes |
$length | int | Data size to transfer |
Type | Description |
---|---|
bool | false if error |


downloadContent(
string $file, int $startOffset
=
0, int $length
=
false
)
:
void
Handles the data part of a file transfer to the client
Name | Type | Description |
---|---|---|
$file | string | Path to the local file |
$startOffset | int | Offset to start transfer from, in bytes |
$length | int | Data size to transfer |
- See
- \download()


downloadHeaders(
string $file, bool $isAttachedDownload
=
true, string $overrideFilename
=
false, int $startOffset
=
0, int $length
=
false, string $fileSize
=
false
)
:
void
Handles the header part of a file transfer to the client
Name | Type | Description |
---|---|---|
$file | string | Path to the local file |
$isAttachedDownload | bool | Determines weather to download the file as an attachment ( download popup box ) or not. |
$overrideFilename | string | Filename to send in headers instead of the actual file's name |
$startOffset | int | Offset to start transfer from, in bytes |
$length | int | Data size to transfer |
$fileSize | string | The file's size. If not given, actual filesize will be queried. Required to work with clusterized files... |
- See
- \download()


rename(
string $srcFile, string $destFile, bool $mkdir
=
false, int $flags
=
0
)
:
bool
Renames $srcFile to $destFile atomically on Unix, and provides a workaround for Windows.
Usage example:
$srcFile = '/path/to/src/file';
$destFile = '/path/to/dest/file';
eZFile::rename( $srcFile, $destFile );
// Using flags
// In following example, if rename operation fails, $srcFile will be deleted and a message will be appended in eZDebug
eZFile::rename( $srcFile, $destFile, false, eZFile::APPEND_DEBUG_ON_FAILURE | eZFile::CLEAN_ON_FAILURE );
Name | Type | Description |
---|---|---|
$srcFile | string | Source file path |
$destFile | string | Destination file path |
$mkdir | bool | Make directory for destination file if needed |
$flags | int | Supported flags are : - APPEND_DEBUG_ON_FAILURE (will append a message to the debug if operation fails - CLEAN_ON_FAILURE (Will remove $srcFile if operation fails) |
Type | Description |
---|---|
bool | rename() status (true if successful, false if not) |


splitLines(
$file
)
:
array | false
Reads the whole contents of the file \a $file and splits it into lines which is collected into an array and returned.
It will handle Unix (\n), Windows (\r\n) and Mac (\r) style newlines. \note The newline character(s) are not present in the line string.
Name | Type | Description |
---|---|---|
$file |
Type | Description |
---|---|
array | false |
- Deprecated
- Since 4.4, use file( $file, FILE_IGNORE_NEW_LINES ) instead.