/** * Returns a temporary file - one that is automatically deleted at the end * of the script. * * @param string $ext * @return Temp */ public static function temp_file($ext = '') { $ext = $ext ? '.' . $ext : ''; Temp::set_temp_root(api_get_path(SYS_ARCHIVE_PATH) . 'temp'); $path = Temp::get_temporary_name() . $ext; return Temp::create($path); }