/** * Create a stream to be used for large entries. * * @param string $filePath Filepath and name to be used in the archive. * @param int $timestamp (Optional) Timestamp for the added file, if omitted or set to 0, the current time will be used. * @param string $fileComment (Optional) Comment to be added to the archive for this file. To use fileComment, timestamp must be given. * @return bool $success */ public function openStream($filePath, $timestamp = 0, $fileComment = null) { if ($this->isFinalized) { return false; } if (is_null($this->zipFile)) { $this->zipFile = tmpfile(); fwrite($this->zipFile, $this->zipData); $this->zipData = null; } if (strlen($this->streamFilePath) > 0) { closeStream(); } $this->streamFile = tempnam(sys_get_temp_dir(), 'Zip'); $this->streamData = gzopen($this->streamFile, "w9"); $this->streamFilePath = $filePath; $this->streamTimestamp = $timestamp; $this->streamFileComment = $fileComment; $this->streamFileLength = 0; return true; }
/** * Create a stream to be used for large entries. * * @param String $filePath Filepath and name to be used in the archive. * @param int $timestamp (Optional) Timestamp for the added file, if omitted or set to 0, the current time will be used. * @param String $fileComment (Optional) Comment to be added to the archive for this file. To use fileComment, timestamp must be given. * @return bool $success */ public function openStream($filePath, $timestamp = 0, $fileComment = null) { if (!function_exists('sys_get_temp_dir')) { die("ERROR: Zip " . self::VERSION . " requires PHP version 5.2.1 or above if large files are used."); } if ($this->isFinalized) { return FALSE; } $this->zipflush(); if (strlen($this->streamFilePath) > 0) { closeStream(); } $this->streamFile = tempnam(sys_get_temp_dir(), 'Zip'); $this->streamData = fopen($this->streamFile, "wb"); $this->streamFilePath = $filePath; $this->streamTimestamp = $timestamp; $this->streamFileComment = $fileComment; $this->streamFileLength = 0; return TRUE; }