/** * update file according to filename * * @param string $filename * @param string $content base 64 encoded string * @param string $action can be Attach or Detach */ private function updateFile($filename, $b64encodedContent, $action) { if (strlen($filename) == 0) { return; } $filename = $this->storage->getAbsolutePath() . "/" . $filename; if ($action == "Attach") { $content = base64_decode((string) $b64encodedContent); if ($this->mode == ilExerciseXMLParser::$CONTENT_GZ_COMPRESSED) { $content = gzdecode($content); } elseif ($this->mode == ilExerciseXMLParser::$CONTENT_ZLIB_COMPRESSED) { $content = gzuncompress($content); } //echo $filename; $this->storage->writeToFile($content, $filename); } if ($action == "Detach") { $this->storage->deleteFile($filename); } }