Class \Scrivo\Downloadable
The Scrivo Downloadable class is a simple conveniance class to pass downloadable file data from an action.
Defined in: Downloadable.php.
Attr. | Name / Description |
---|---|
public |
Downloadable($context, $action, $type, $data) Construct a Downloadable object to pass from an action. |
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. |
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 |
Attr. | Type | Name / Description |
---|---|---|
public |
Get the file name to use in the download headers. |
|
public |
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).
View source: Downloadable.php line 89.
Constants
- TYPE_FILE
-
Constant to denote that we pass the actual file content in a file.
Value: 2
View source: Downloadable.php line 52.
- type_data
-
Constant to denote that we pass the actual file content in a variable.
Value: 1
View source: Downloadable.php line 47.
Members
- private \Scrivo\String $action
-
The file name to use in the download.
View source: Downloadable.php line 64.
- 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
View source: Downloadable.php line 71.
- private int $type
-
The download source type: either type_data or TYPE_FILE
View source: Downloadable.php line 58.
Methods
- public getFileName()
-
Get the file name to use in the download headers.
View source: Downloadable.php line 133.
- public outputData()
-
Output the file data to stdout.
If the file data was read from a temporary file, the file will be deleted afterwards.
View source: Downloadable.php line 121.
Documentation generated by phpDocumentor 2.0.0a12 and ScrivoDocumentor on August 29, 2013