/** * Save raw content to a file to the server * * @param string $file The path of the file to be saved * @param string $contents The contents of the file to be saved * @param bool $checkDir Whether or not to check to see if the parent directory exists before attempting to save the file * @return bool True on success */ function Save($file, $contents, $checkDir = true) { $fp = gpFiles::fopen($file, $checkDir); if (!$fp) { return false; } if (fwrite($fp, $contents) === false) { fclose($fp); return false; } fclose($fp); return true; }