private function dumpFile($file_path, $file_name, $limit_file_size = 0) { $file_name = str_replace("\n", ' ', $file_name); $relocate = $this->getRequestParameter("relocate"); $directServe = $this->getRequestParameter("direct_serve"); if (!$relocate) { $url = $_SERVER["REQUEST_URI"]; if (strpos($url, "?") !== false) { $url .= "&relocate="; } else { $url .= "/relocate/"; } $url .= kString::stripInvalidUrlChars($file_name); kFile::cacheRedirect($url); header("Location: {$url}"); KExternalErrors::dieGracefully(); } else { if (!$directServe) { header("Content-Disposition: attachment; filename=\"{$file_name}\""); } $mime_type = kFile::mimeType($file_path); kFileUtils::dumpFile($file_path, $mime_type, null, $limit_file_size); } }