2 namespace TYPO3\CMS\Core\Http\Observer;
68 public function update(\SplSubject $request)
70 $event = $request->getLastEvent();
71 switch ($event[
'name']) {
72 case 'receivedHeaders':
73 if ($this->targetFilename ===
'') {
78 case 'receivedBodyPart':
79 case 'receivedEncodedBodyPart':
80 fwrite($this->filePointer, $event[
'data']);
99 if (!is_dir($directory)) {
100 throw new \InvalidArgumentException($directory .
' is not a directory', 1312223779);
103 throw new \InvalidArgumentException($directory .
' is not within the PATH_site' .
' OR within the lockRootPath', 1328734617);
105 $this->targetDirectory = ($directory = rtrim($directory, DIRECTORY_SEPARATOR));
118 $this->targetFilename = basename(
$filename);
132 $disposition = $response->
getHeader(
'content-disposition');
133 if ($disposition !== null && 0 === strpos($disposition,
'attachment') && 1 === preg_match(
'/filename="([^"]+)"/', $disposition, $matches)) {
153 if ($this->targetFilename ===
'') {
154 throw new \UnexpectedValueException(
'The file name must not be empty', 1321113658);
157 $this->filePointer = @fopen($this->targetFilePath,
'wb');
158 if ($this->filePointer ===
false) {
159 throw new \TYPO3\CMS\Core\Exception(
'Cannot open target file ' . $this->targetFilePath, 1320833203);
170 fclose($this->filePointer);
171 $this->filePointer =
false;
172 \TYPO3\CMS\Core\Utility\GeneralUtility::fixPermissions($this->targetFilePath);