client/html/src/Client/Html/Account/Download/Standard.php
protected function addDownload( \Aimeos\MShop\Order\Item\Base\Product\Attribute\Iface $item )
	{
		$fs = $this->getContext()->getFilesystemManager()->get( 'fs-secure' );
		$response = $this->getView()->response();
		$value = (string) $item->getValue();

		if( $fs->has( $value ) )
		{
			$name = $item->getName();

			if( pathinfo( $name, PATHINFO_EXTENSION ) == null
					&& ( $ext = pathinfo( $value, PATHINFO_EXTENSION ) ) != null
			) {
				$name .= '.' . $ext;
			}

			$response->withHeader( 'Content-Description', 'File Transfer' );
			$response->withHeader( 'Content-Type', 'application/octet-stream' );
			$response->withHeader( 'Content-Disposition', 'attachment; filename="' . $name . '"' );
			$response->withHeader( 'Content-Length', (string) $fs->size( $value ) );
			$response->withHeader( 'Cache-Control', 'must-revalidate' );
			$response->withHeader( 'Pragma', 'private' );
			$response->withHeader( 'Expires', '0' );

			$response->withBody( $response->createStream( $fs->reads( $value ) ) );
		}
		elseif( filter_var( $value, FILTER_VALIDATE_URL ) !== false )
		{
			$response->withHeader( 'Location', $value );
			$response->withStatus( 303 );
		}
		else
		{
			$response->withStatus( 404 );
		}
	}
protected function addDownload( \Aimeos\MShop\Order\Item\Base\Product\Attribute\Iface $item )
	{
		$fs = $this->getContext()->getFilesystemManager()->get( 'fs-secure' );
		$response = $this->getView()->response();
		$value = (string) $item->getValue();

		if( $fs->has( $value ) )
		{
			$name = $item->getName();

			if( pathinfo( $name, PATHINFO_EXTENSION ) == null
					&& ( $ext = pathinfo( $value, PATHINFO_EXTENSION ) ) != null
			) {
				$name .= '.' . $ext;
			}

			$response->withHeader( 'Content-Description', 'File Transfer' );
			$response->withHeader( 'Content-Type', 'application/octet-stream' );
			$response->withHeader( 'Content-Disposition', 'attachment; filename="' . $name . '"' );
			$response->withHeader( 'Content-Length', (string) $fs->size( $value ) );
			$response->withHeader( 'Cache-Control', 'must-revalidate' );
			$response->withHeader( 'Pragma', 'private' );
			$response->withHeader( 'Expires', '0' );

			$response->withBody( $response->createStream( $fs->reads( $value ) ) );
		}
		elseif( filter_var( $value, FILTER_VALIDATE_URL ) !== false )
		{
			$response->withHeader( 'Location', $value );
			$response->withStatus( 303 );
		}
		else
		{
			$response->withStatus( 404 );
		}
	}
protected function addDownload ( \ Aimeos \ MShop \ Order \ Item \ Base \ Product \ Attribute \ Iface $ item ) { $ fs = $ this -> getContext ( ) -> getFilesystemManager ( ) -> get ( 'fs-secure' ) ; $ response = $ this -> getView ( ) -> response ( ) ; $ value = ( string ) $ item -> getValue ( ) ; if ( $ fs -> has ( $ value ) ) { $ name = $ item -> getName ( ) ; if ( pathinfo ( $ name , PATHINFO_EXTENSION ) == null && ( $ ext = pathinfo ( $ value , PATHINFO_EXTENSION ) ) != null ) { $ name .= '.' . $ ext ; } $ response -> withHeader ( 'Content-Description' , 'File Transfer' ) ; $ response -> withHeader ( 'Content-Type' , 'application/octet-stream' ) ; $ response -> withHeader ( 'Content-Disposition' , 'attachment; filename="' . $ name . '"' ) ; $ response -> withHeader ( 'Content-Length' , ( string ) $ fs -> size ( $ value ) ) ; $ response -> withHeader ( 'Cache-Control' , 'must-revalidate' ) ; $ response -> withHeader ( 'Pragma' , 'private' ) ; $ response -> withHeader ( 'Expires' , '0' ) ; $ response -> withBody ( $ response -> createStream ( $ fs -> reads ( $ value ) ) ) ; } elseif ( filter_var ( $ value , FILTER_VALIDATE_URL ) !== false ) { $ response -> withHeader ( 'Location' , $ value ) ; $ response -> withStatus ( 303 ) ; } else { $ response -> withStatus ( 404 ) ; } }
Adds the necessary headers and the download content to the reponse object

@param \Aimeos\MShop\Order\Item\Base\Product\Attribute\Iface $item Order product attribute item with file reference
Adds the necessary headers and the download content to the reponse object