Feature: #92518 - Introduce FileViewHelper

See forge#92518


With #92518, the \TYPO3\CMS\Core\Controller\FileDumpController has been extended with new options to force the download of a file, as well as the option to define a custom filename.

To ease the use of the file dump functionality, especially the newly introduced options, a new ViewHelper TYPO3\CMS\Fluid\ViewHelpers\Link\FileViewHelper is added, which allows extension authors to easily create links to both public and non-public files.

The usage is as following:

<f:link.file file="{file}" download="true" filename="alternative-name.jpg">
   Download file

The above example will create a link to the given file, forcing a direct download, while using the alternative filename.

In case the file is publicly accessible, a direct link will be used. Otherwise the file dump functionality comes into play.

<!-- Public file -->
<a href="https://example.com/fileadmin/path/to/file.jpg"
   Download file

<!-- Non-public file -->
<a href="https://example.com/index.php?eID=dumpFile&t=f&f=123&dl=1&fn=alternative-name.jpg&token=79bce812">
   Download file


The file argument accepts a \TYPO3\CMS\Core\Resource\FileInterface. So either a \TYPO3\CMS\Core\Resource\File, a \TYPO3\CMS\Core\Resource\FileReference or a \TYPO3\CMS\Core\Resource\ProcessedFile can be provided.


The filename argument accepts an alternative filename. In case the provided filename contains a file extension, this must be the same as from the file object. If file extensions is omitted, the original file extension is automatically appended to the given filename.


The new ViewHelper allows creating links to files - even non-public ones - in a straightforward way within Fluid templates.