Search code examples
typo3typo3-7.6.xtypo3-8.xtypo3-extensions

Input file accept only PDF in typo3 Fluid


This is the method in Normal HTML to accept only PDF

<input type="file" name="myFile" accept="application/pdf" />

But How to use it with Typo3 Fluid? When I gave like this

<f:form.upload name="myFile" accept="application/pdf" /> 

It showed me an error as below

#1237823695: Argument "accept" was not registered.

How can I do this in fluid?

(I'm using Typo3 7.6.21)


Solution

  • you can do this with additionalAttributes.

    Here a link to the Fluid doc https://fluidtypo3.org/viewhelpers/fluid/master/Form/UploadViewHelper.html

    Complete ViewHelper Code looks like:

    <f:form.upload additionalAttributes="{accept :'application/pdf'}" name="test2"/>