[TYPO3-mvc] 6.2 and Fileupload
Christian Tauscher
christian.tauscher at media-distillery.de
Mon Apr 6 18:49:00 CEST 2015
Hello.
I try to impement a fileupload funktion in FE of my EXT.
I found Hemut Hummels "Best Practice" here:
http://insight.helhum.io/post/85015526410/file-upload-using-extbase-and-fal-in-typo3-6-2
(does not work, produce any output, some classes are wrongly named,
still think this example sould work since it is claimed to be "Best
Practice")
So foar it souds good, and since I failed with all other examples up to
now, too, give it a try:
(extbase-code is so huge I poste here only the parts that do not work,
knowing the error may be caused somewhere else... If you think you need
the whole EXT code, drop me a line. No secrets in it)
starting with the uploads_example I adopted all necessary fiels to my
EXT, changing namespace ect. Since there are no errors with this
reported I assume the files are correctly adopted.
TCA: OK
Templates/Partials correct, get expected/good <f:debug> output
Resources/Partials/Templates/... seems good.
TS-Setup:
config.tx_extbase.persistence.classes {
Tmd\Screenprinting\Domain\Model\FileReference {
mapping {
tableName = sys_file_reference
columns {
uid_local.mapOnProperty = originalFileIdentifier
}
}
}
}
config.tx_extbase.objects {
TYPO3\CMS\Extbase\Domain\Model\FileReference.className =
Tmd\Screenprinting\Domain\Model\FileReference
}
Not sure if this is needed.... Hmmm... Correct?
Classes/Viewhelpers/UploadViewHelper, not much to change
Property/TypeConverter/
UploadedFileReferenceConverter.php, ObjectStorageConverter.php:
some namespaces had to be adopted. not much to change. Should be OK so far.
Domain/FileReference.php, only different namespace.
Domain/Example.php, here I took the important lines to declare the
variables, the getter/setter. Should work. DB hase the same fields.
Now the "living" Parts:
Classes/Controller/PrintitemController.php:
First started with the updateFormAction:
The FE renders the Form, even with the image now. Great.
Press Update Button: Fails
:-(
#1297759968: Exception while property mapping at property path
"image":It is not allowed to map property "submittedFile". You need to
use $propertyMappingConfiguration->allowProperties('submittedFile') to
enable mapping of this property. (More information)
I tryed to track this down with some die() commands. Wich line causes
the error?
* updateFormAction. OK
* initializeUpdateAction, OK
updateAction sould be called next width a die('here9');
This is never Reached.
So after initializeUpdateAction(), last Command was a die() the next in
cue is not called, but fails???
TYPO3\CMS\Extbase\Property\Exception thrown in file
/typo3_src-6.2.9/typo3/sysext/extbase/Classes/Property/PropertyMapper.php in
line 106.
Any help/hint welcome.
Thank you,
Christian.
/**
* @param \Tmd\screenprinting\Domain\Model\Printitem $printitem
* @return void
*/
public function
updateFormAction(\Tmd\screenprinting\Domain\Model\Printitem $printitem) {
$options = $this->getAllFormOptions();
$this->view->assign('printitem', $printitem);
}
/**
* Set TypeConverter option for image upload
*/
public function initializeUpdateAction() {
$this->setTypeConverterConfigurationForImageUpload('printitem');
}
/**
* @param \Tmd\Screenprinting\Domain\Model\Printitem $printitem
* @return void
*/
public function updateAction(\Tmd\Screenprinting\Domain\Model\Printitem
$printitem) {
die('here9');
$this->printitemRepository->update($printitem);
$this->addFlashMessage('Your Item was updated.');
$this->redirect('list');
}
More information about the TYPO3-project-typo3v4mvc
mailing list