getSize()) { return false; } $target = fopen($path, "w"); if (!is_resource($target)) { return false; } fseek($temp, 0, SEEK_SET); stream_copy_to_stream($temp, $target); fclose($target); return true; } /** * get qqfile name from _GET array * * @return string */ public function getName(): string { return !empty($_GET['qqfile']) && is_string($_GET['qqfile']) ? $_GET['qqfile'] : ''; } /** * Get file size from _SERVERa array, throws an error if not possible * * @return int size of the file * * @throws \Exception */ public function getSize(): int { if (isset($_SERVER['CONTENT_LENGTH']) && is_numeric($_SERVER['CONTENT_LENGTH'])) { return (int)$_SERVER['CONTENT_LENGTH']; } else { throw new \Exception('Getting content length is not supported.'); } } } // __END__