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

FE Image Upload does not work anymore since latest Typo3 12 Minor Update #555

Open
gpazout opened this issue Mar 13, 2024 · 3 comments
Open

Comments

@gpazout
Copy link

gpazout commented Mar 13, 2024

Since updating from Typo3 12.4.10 to 12.4.12 the image upload (or file upload generally speaking) via the FE does not work anymore!

I get the following Exception:
#1297759968 TYPO3\CMS\Extbase\Property\Exception Exception while property mapping at property path "image.0": Property "name" was not found in target object of type "TYPO3\CMS\Extbase\Domain\Model\FileReference".

I am very confident, that the reason for that is the following patch: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81594
More particular the changes in typo3/sysext/extbase/Classes/Mvc/Web/RequestBuilder.php: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81594/6/typo3/sysext/extbase/Classes/Mvc/Web/RequestBuilder.php

When I change if ($useArgumentsWithoutNamespace && count($fileParameters)) back to if (count($fileParameters)) the file upload works without any flaws!

Is anyone else experiencing the same issue? If so how did you fix it?

Are we supposed to use TypoConverters again for FE image upload? It is so weird, because as far as I understand the patch was originally unofficially introduced a few month ago as a fix, because apparently the Typo3 devs messed up and broke the FE image upload via TypoConverters back then.

@proseriox
Copy link

proseriox commented Mar 19, 2024

having the same issue in v12.4.

In v13 seems like the codeblock ...backwards compatibility... has been also removed. It works in v13 fine.

v12 https://github.com/TYPO3/typo3/blob/12.4/typo3/sysext/extbase/Classes/Mvc/Web/RequestBuilder.php
v13 https://github.com/TYPO3/typo3/blob/13.0/typo3/sysext/extbase/Classes/Mvc/Web/RequestBuilder.php

hit me also up if someone knows how to fix it

Edit:

Updated by Andreas Wolf 3 days ago
During a session at T3CMD24 we realized that this behaviour actually comes from the backwards compatibility layer introduced in #97214; that layer was removed for main, but in v12, some people might rely on it now since v12 was released quite a while ago. Therefore, I personally would not fix it anymore to prevent breaking instances with a patchlevel release.

@manuelportela
Copy link

@proseriox do you know what Andreas means by "Therefore, I personally would not fix it anymore to prevent breaking instances with a patchlevel release."?
Will it be re-fixed in 12? How do you go forward from here?

@gpazout
Copy link
Author

gpazout commented May 29, 2024

hit me also up if someone knows how to fix it

You need to adjust some code.

Partial Image.html

from this:

<f:form.upload
	id="femanager_field_image"
	property="image.0"
	class="custom-file-input" />

to this:

<f:form.upload
	id="femanager_field_image"
	name="image"
	class="custom-file-input" />

Controller

protected function processUploadedImage($user)
{
        $uploadedFiles = $this->request->getUploadedFiles(); // the image is now in $uploadedFiles['image'], not in $uploadedFiles['user']['image']

        // ...allowed file types

        if (
            count($uploadedFiles) > 0
            && !empty($uploadedFiles['image'])
        ) {         
            $images = [];
            $images[] = $uploadedFiles['image']; // add image to an array (this way the original code in the foreach loop below does not have to be changed at all)

            foreach ($images as $uploadedFile) {
                      // rest of code unchanged
            }
}

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

3 participants