lib/ezfile/classes/ezfile.php

Show: inherited
Table of Contents

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

Package: lib

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

Constant  READ_PACKET_SIZE = 16384

Number of bytes read per fread() operation.

See
\downloadContent()  
Constant  CLEAN_ON_FAILURE = 1

Flags for file manipulation

See
\rename()  

Methods

methodpubliccreate(  $filename,  $directory = false,  $data = false,  $atomic = false ) : void
static

Parameters
Name Type Description
$filename
$directory
$data
$atomic
methodpublicdownload( string $file, bool $isAttachedDownload = true, string $overrideFilename = false, int $startOffset = 0, int $length = false ) : bool
static

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)

Parameters
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

Returns
Type Description
bool false if error
methodpublicdownloadContent( string $file, int $startOffset = 0, int $length = false ) : void
static

Handles the data part of a file transfer to the client

Parameters
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

Details
See
\download()  
methodpublicdownloadHeaders( string $file, bool $isAttachedDownload = true, string $overrideFilename = false, int $startOffset = 0, int $length = false, string $fileSize = false ) : void
static

Handles the header part of a file transfer to the client

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

Details
See
\download()  
methodpublicgetContents(  $filename ) : void
static

Parameters
Name Type Description
$filename
methodpublicisWriteable(  $filename ) : void
static

Parameters
Name Type Description
$filename
methodpublicrename( string $srcFile, string $destFile, bool $mkdir = false, int $flags = 0 ) : bool
static

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 );
Parameters
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)

Returns
Type Description
bool rename() status (true if successful, false if not)
methodpublicsplitLines(  $file ) : array | false
static

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.

Parameters
Name Type Description
$file
Returns
Type Description
array | false
Details
Deprecated
Since 4.4, use file( $file, FILE_IGNORE_NEW_LINES ) instead.  
methodpublicsuffix(  $filename ) : void
static

Parameters
Name Type Description
$filename
Documentation was generated by DocBlox 0.18.1.