67 public function update(\SplSubject $request) {
68 $event = $request->getLastEvent();
69 switch ($event[
'name']) {
70 case 'receivedHeaders':
71 if ($this->targetFilename ===
'') {
76 case 'receivedBodyPart':
78 case 'receivedEncodedBodyPart':
79 fwrite($this->filePointer, $event[
'data']);
97 if (!is_dir($directory)) {
98 throw new \InvalidArgumentException($directory .
' is not a directory', 1312223779);
100 if (!\
TYPO3\CMS\Core\Utility\GeneralUtility::isAllowedAbsPath($directory)) {
101 throw new \InvalidArgumentException($directory .
' is not within the PATH_site' .
' OR within the lockRootPath', 1328734617);
103 $this->targetDirectory = ($directory = rtrim($directory, DIRECTORY_SEPARATOR));
115 $this->targetFilename = basename($filename);
126 protected function determineFilename(\HTTP_Request2 $request, \HTTP_Request2_Response $response) {
128 $disposition = $response->getHeader(
'content-disposition');
129 if ($disposition !== NULL && 0 === strpos($disposition,
'attachment') && 1 === preg_match(
'/filename="([^"]+)"/', $disposition, $matches)) {
130 $filename = basename($matches[1]);
132 $filename = basename($request->getUrl()->getPath());
148 if ($this->targetFilename ===
'') {
149 throw new \UnexpectedValueException(
'The file name must not be empty', 1321113658);
152 $this->filePointer = @fopen($this->targetFilePath,
'wb');
153 if ($this->filePointer === FALSE) {
154 throw new \TYPO3\CMS\Core\Exception(
'Cannot open target file ' . $this->targetFilePath, 1320833203);
164 fclose($this->filePointer);
165 $this->filePointer = FALSE;
static fixPermissions($path, $recursive=FALSE)
__construct($directory, $filename='')
update(\SplSubject $request)
determineFilename(\HTTP_Request2 $request, \HTTP_Request2_Response $response)
setFilename($filename='')