Commit d6f2f7a6 authored by Henrik Elsner's avatar Henrik Elsner Committed by Christian Kuhn
Browse files

[FEATURE] Add "accept" as UploadViewHelper argument

Resolves: #95486
Releases: master
Change-Id: I6f9927e524e9d44e4e976ec948614d02d3a24edc

Tested-by: core-ci's avatarcore-ci <>
Tested-by: Christian Kuhn's avatarChristian Kuhn <>
Tested-by: Stefan Bürk's avatarStefan Bürk <>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <>
Reviewed-by: Stefan Bürk's avatarStefan Bürk <>
parent 04e55537
.. include:: ../../Includes.txt
Feature: #95486 - Add accept argument for UploadViewHelper
See :issue:`95486`
It is now possible to pass file types via "accept" as argument directly to the
Previously this had to be done by using "additionalAttributes".
This way it can be defined which file types are allowed for uploads,
to prevent unwanted file formats.
.. code-block:: html
<f:form.upload accept=".jpg,.png" />
.. index:: Fluid, ext:fluid
......@@ -45,6 +45,7 @@ class UploadViewHelper extends AbstractFormFieldViewHelper
$this->registerTagAttribute('disabled', 'string', 'Specifies that the input element should be disabled when the page loads');
$this->registerTagAttribute('multiple', 'string', 'Specifies that the file input element should allow multiple selection of files');
$this->registerTagAttribute('accept', 'string', 'Specifies the allowed file extensions to upload via comma-separated list, example ".png,.gif"');
$this->registerArgument('errorClass', 'string', 'CSS class to set if there are errors for this ViewHelper', false, 'f3-form-error');
......@@ -58,6 +58,16 @@ class UploadViewHelperTest extends FunctionalTestCase
self::assertSame('<input multiple="multiple" type="file" name="someName[]" />', $view->render());
* @test
public function renderCorrectlySetsAcceptAttribute(): void
$view = new StandaloneView();
$view->setTemplateSource('<f:form.upload accept=".jpg,.png" />');
self::assertSame('<input accept=".jpg,.png" type="file" name="" />', $view->render());
* @test
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment