TYPO3
7.6
|
Public Member Functions | |
__construct ($directory, $filename= '') | |
update (\SplSubject $request) | |
setDirectory ($directory) | |
setFilename ($filename= '') | |
Protected Member Functions | |
determineFilename (\HTTP_Request2 $request,\HTTP_Request2_Response $response) | |
openFile () | |
closeFile () | |
Protected Attributes | |
$filePointer = false | |
$targetFilePath = '' | |
$targetDirectory = '' | |
$targetFilename = '' | |
Observer to automatically save a http request chunk by chunk to a file. If the file already exists, it will be overwritten. This follows an example in HTTP_Request2 manual.
Definition at line 24 of file Download.php.
__construct | ( | $directory, | |
$filename = '' |
|||
) |
Constructor
\InvalidArgumentException | if directory is not found or is not within the PATH_site |
string | $directory | The absolute path to the directory in which the file is saved. |
string | $filename | The filename - if not set, it is determined automatically. |
Definition at line 53 of file Download.php.
References $filename, Download\setDirectory(), and Download\setFilename().
|
protected |
Closes the file handler and fixes permissions.
Definition at line 168 of file Download.php.
Referenced by Download\update().
|
protected |
Determines the filename from either the 'content-disposition' header or from the basename of the current request.
\HTTP_Request2 | $request | |
\HTTP_Request2_Response | $response |
Definition at line 129 of file Download.php.
References $filename, HTTP_Request2_Response\getHeader(), HTTP_Request2\getUrl(), and Download\setFilename().
Referenced by Download\update().
|
protected |
Determines the absolute path to the file by combining the directory and filename. Afterwards tries to open the file for writing.
$this->filename must be set before calling this function.
\UnexpectedValueException | if $this->filename is not set |
\TYPO3\CMS\Core\Exception | if file can not be opened |
Definition at line 151 of file Download.php.
References Download\$targetFilename.
Referenced by Download\update().
setDirectory | ( | $directory | ) |
Sets the directory and checks whether the directory is available.
\InvalidArgumentException | if directory is not found or is not within the PATH_site |
string | $directory | The absolute path to the directory in which the file is saved. |
Definition at line 97 of file Download.php.
References GeneralUtility\isAllowedAbsPath().
Referenced by Download\__construct().
setFilename | ( | $filename = '' | ) |
Sets the filename.
If the file already exists, it will be overridden
string | $filename | The filename |
Definition at line 116 of file Download.php.
References $filename.
Referenced by Download\__construct(), and Download\determineFilename().
update | ( | \SplSubject | $request | ) |
Saves current chunk to disk each time a body part is received. If the filename is empty, tries to determine it from received headers
\TYPO3\CMS\Core\Exception | if file can not be opened |
\UnexpectedValueException | if the file name is empty and can not be determined from headers |
\SplSubject | \HTTP_Request2 | $request |
Definition at line 68 of file Download.php.
References Download\closeFile(), Download\determineFilename(), and Download\openFile().
|
protected |
Definition at line 29 of file Download.php.
|
protected |
Definition at line 39 of file Download.php.
|
protected |
Definition at line 44 of file Download.php.
Referenced by Download\openFile().
|
protected |
Definition at line 34 of file Download.php.