src/Server.php
protected function handleHEAD(): ResponseInterface
	{

		// Extension Thunder TUS Express: create the file on HEAD request
		if ($this->extExpress) {
			$this->response = $this->handlePOST();
			$code           = $this->response->getStatusCode();
			if ($code !== 201 && $code !== 409)
				return $this->response;
			$this->response = $this->response->withHeader("Location", $this->location);
		}
		else { // For Standard TUS
			if (!is_file($this->file))
				return $this->response->withStatus(404);
		}

		// Standard TUS HEAD response
		$localSize = filesize($this->file);

		return $this->response->withStatus(200)
		                      ->withHeader("Upload-Offset", $localSize);

	}
protected function handleHEAD(): ResponseInterface
	{

		// Extension Thunder TUS Express: create the file on HEAD request
		if ($this->extExpress) {
			$this->response = $this->handlePOST();
			$code           = $this->response->getStatusCode();
			if ($code !== 201 && $code !== 409)
				return $this->response;
			$this->response = $this->response->withHeader("Location", $this->location);
		}
		else { // For Standard TUS
			if (!is_file($this->file))
				return $this->response->withStatus(404);
		}

		// Standard TUS HEAD response
		$localSize = filesize($this->file);

		return $this->response->withStatus(200)
		                      ->withHeader("Upload-Offset", $localSize);

	}
protected function handleHEAD ( ) : ResponseInterface { // Extension Thunder TUS Express: create the file on HEAD request if ( $ this -> extExpress ) { $ this -> response = $ this -> handlePOST ( ) ; $ code = $ this -> response -> getStatusCode ( ) ; if ( $ code !== 201 && $ code !== 409 ) return $ this -> response ; $ this -> response = $ this -> response -> withHeader ( "Location" , $ this -> location ) ; } else { // For Standard TUS if ( ! is_file ( $ this -> file ) ) return $ this -> response -> withStatus ( 404 ) ; } // Standard TUS HEAD response $ localSize = filesize ( $ this -> file ) ; return $ this -> response -> withStatus ( 200 ) -> withHeader ( "Upload-Offset" , $ localSize ) ; }
Handle HEAD requests.

Informs the client about the status of a file. If the file exists, the number of bytes (offset) already
stored in the server is also provided.

If the client uses the ThunderTUS Express extension this method will also create new files bypassing
the need to call POST.

@return \Psr\Http\Message\ResponseInterface
Handle HEAD requests .