public function serve($as = null)
	{
		// Initiate a new content server
		$server = new \Hubzero\Content\Server();
		$server->disposition('attachment');
		$server->acceptranges(false);

		if (!$this->isLocal())
		{
			// Create a temp file and write to it
			$temp = tmpfile();
			fwrite($temp, $this->read());
			$server->filename(stream_get_meta_data($temp)['uri']);
		}
		else
		{
			$server->filename($this->getAbsolutePath());
		}

		$server->saveas($as ?: $this->getFileName());

		// Serve up the file
		$result = $server->serve();

		// Clean up after serving
		if (isset($temp) && is_resource($temp))
		{
			fclose($temp);
		}

		return $result;
	}
public function serve($as = null)
	{
		// Initiate a new content server
		$server = new \Hubzero\Content\Server();
		$server->disposition('attachment');
		$server->acceptranges(false);

		if (!$this->isLocal())
		{
			// Create a temp file and write to it
			$temp = tmpfile();
			fwrite($temp, $this->read());
			$server->filename(stream_get_meta_data($temp)['uri']);
		}
		else
		{
			$server->filename($this->getAbsolutePath());
		}

		$server->saveas($as ?: $this->getFileName());

		// Serve up the file
		$result = $server->serve();

		// Clean up after serving
		if (isset($temp) && is_resource($temp))
		{
			fclose($temp);
		}

		return $result;
	}
public function serve ( $ as = null ) { // Initiate a new content server $ server = new \ Hubzero \ Content \ Server ( ) ; $ server -> disposition ( 'attachment' ) ; $ server -> acceptranges ( false ) ; if ( ! $ this -> isLocal ( ) ) { // Create a temp file and write to it $ temp = tmpfile ( ) ; fwrite ( $ temp , $ this -> read ( ) ) ; $ server -> filename ( stream_get_meta_data ( $ temp ) [ 'uri' ] ) ; } else { $ server -> filename ( $ this -> getAbsolutePath ( ) ) ; } $ server -> saveas ( $ as ? : $ this -> getFileName ( ) ) ; // Serve up the file $ result = $ server -> serve ( ) ; // Clean up after serving if ( isset ( $ temp ) && is_resource ( $ temp ) ) { fclose ( $ temp ) ; } return $ result ; }
Serves up the file to the web

@param   string  $as  What to serve the file as
@return  bool
Serves up the file to the web