femanager
femanager copied to clipboard
FE Image Upload does not work anymore since latest Typo3 12 Minor Update
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.
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.
@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?
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
}
}
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 } }
I cannot confirm this solution. I changed the code as described and now I get the following error:
"Exception while property mapping at property path "image.name": The identity property "5-mb-example-file.pdf" is no UID."
The error occurs before the "processUploadedImage" function.
Tested with TYPO3: 12.4.16 femanager: 8.1.0
Same error here, tested with: TYPO3 12.4.16 femanager 8.1.0
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 } }
This works for me with TYPO3 12.4.16 and femanager 8.1.0, but ONLY on update, not on create.
Also, I get the following error when trying to delete the image in the edit form: "You are not allowed to delete this image"
Is there currently a solution to this problem?