[TYPO3-dev] FAL: Remove files in frontend extension

Frans Saris franssaris at gmail.com
Tue Apr 22 16:27:50 CEST 2014


Hi Klaus,

could you do a var_dump() on $this->files to see what is in there?

gr. Frans


2014-04-22 11:44 GMT+02:00 Klaus Heuer <post at heuer-illustration.de>:

> Hi list,
>
> in my extbase extension I need a FRONTEND  image upload / delete function
> with FAL.
>
> The upload function is working well, thanks to Frans for his bitbucket
> fal_fe_upload snippet.
>
> But how to detach a file?
>
> class my model
>  /**
>      * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\
> TYPO3\CMS\Extbase\Domain\Model\FileReference> $file
>      *
>      */
>     protected $file;
> ...
>     /**
>      * Adds a file // this is working well
>      *
>      * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $file
>      *
>      * @return void
>      */
>     public function addFile(\TYPO3\CMS\Extbase\Domain\Model\FileReference
> $file) {
>         $this->files->attach($file);
>     }
>
>     /**
>      * Removes a file // will not work
>      *
>      * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $file
>      * @return void
>      */
>     public function removeFile($file) {
>     $this->files->detach($file);
> }
>
> Ends in Error: Call to undefined function detach() ....
>
> I will not remove the file itself, only the entry in the file reference
> table...
>
> There are some hints in the net, that I have to build my own database
> query here, but I can't belive, that an attach is working - and for a
> detach I have to build the complete query by my own.
>
> Have someone done similar and can give me a hint?
>
> System: TYPO3 6.2.1
>
> Thanks, Klaus
>
>
> _______________________________________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev
>



More information about the TYPO3-dev mailing list