Class \Scrivo\Downloadable

The Scrivo Downloadable class is a simple conveniance class to pass downloadable file data from an action.

Defined in: Downloadable.php.


Constructor summary

Attr. Name / Description
public

Downloadable($context, $action, $type, $data)

Construct a Downloadable object to pass from an action.

Constant summary

Name Description
TYPE_FILE Constant to denote that we pass the actual file content in a file.
type_data Constant to denote that we pass the actual file content in a variable.

Member summary

Attr. Type Name Description
private \..\String $action The file name to use in the download.
private string $data The binary data to pass in case of type_data or the physical location of the file in case of TYPE_FILE
private int $type The download source type: either type_data or TYPE_FILE

Method summary

Attr. Type Name / Description
public

getFileName()

Get the file name to use in the download headers.

public

outputData()

Output the file data to stdout.

 


Constructor

public Downloadable(\Scrivo\Context $context, \Scrivo\String $action, int $type, string $data)

Construct a Downloadable object to pass from an action.

For smaller files we can simply pass the file data as a variable (type_data), for larger files you can write the data to a temporary file and pass the file name (TYPE_FILE).

Parameters:

Type Name Def. Description
\Scrivo\Context $context

A valid Scrivo context.

\Scrivo\String $action

The file name to use in the download headers, this will be prepended with a string representation of the WWW_ROOT variabele.

int $type

the type of data to download, either type_data or TYPE_FILE.

string $data

The file data (type_data), or file name (TYPE_FILE).


Constants

TYPE_FILE

Constant to denote that we pass the actual file content in a file.

Value: 2

type_data

Constant to denote that we pass the actual file content in a variable.

Value: 1


Members


				
private \Scrivo\String $action

The file name to use in the download.


				
private string $data

The binary data to pass in case of type_data or the physical location of the file in case of TYPE_FILE


				
private int $type

The download source type: either type_data or TYPE_FILE


Methods

public getFileName()

Get the file name to use in the download headers.

public outputData()

Output the file data to stdout.

If the file data was read from a temporary file, the file will be deleted afterwards.


Documentation generated by phpDocumentor 2.0.0a12 and ScrivoDocumentor on August 29, 2013