Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allowedExtensions is always false #59

Open
thpa opened this issue Apr 7, 2023 · 1 comment
Open

allowedExtensions is always false #59

thpa opened this issue Apr 7, 2023 · 1 comment

Comments

@thpa
Copy link

thpa commented Apr 7, 2023

I am using TYPO3 11 and PHP 8.1, non-composer mode.

Every time i try to select a file i get the alert box, that the file extension ist not allowed, but it is one of the allowed.
I tried different files with the file extensions.

I tried to check the values using in the media_upload.js File if the file extensions are available at this point.
Seems all to be correct.

Actually have no clue to start debugging.

@klodeckl
Copy link

Same here. The error occurs if more than one file extension is allowed:
<f:format.raw><mu:widget.upload allowedExtensions="jpg,png,mp4" storage="1" property="media" sizeUnit="MB" maximumSize="20000000" /></f:format.raw>

The error is in the upload viewhelper, the output of the javascript is:
var allowedExtensions= ['jpg,png,mp4'];
but it should be
var allowedExtensions= ['jpg','png','mp4'];

It is not a real fix but I solved it the following way:

In the viewhelper template:
var allowedExtensions= ['<f:format.raw><f:cObject typoscriptObjectPath="lib.replace_comma">{allowedExtensions}</f:cObject></f:format.raw>'];

And this typoscript:
lib.replace_comma = TEXT
lib.replace_comma {
current = 1
stdWrap.replacement {
1 {
search = ,
replace = ','
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants