[TYPO3-project-formidable] UPLOAD or FILE renderlet

Jerome Schneider typo3dev at ameos.com
Tue Oct 30 09:38:43 CET 2007


Hi Manuel,
I think that it would be better with an optional parameter $bUpdateInDb 
default to FALSE, for the cases where no DB is involved.

What do u think ?

Jerome

Manuel Rego Casasnovas a écrit :
> Hi,
> 
> Manuel Rego Casasnovas escribió:
>> I'm testing this option and I have found a bug.
>>
>> When I delete an image the file is deleted, however the field into
>> database isn't updated.
>> And when I submit the form or reload the page the deleted image appears
>> again (the file doesn't exists, only the name of the image into the
>> database).
>>   
> 
> I have modified the function deleteFile to modify database when you use
> this method:
>         function deleteFile($sFile) {
>                 $aValues = t3lib_div::trimExplode(",", $this->_getValue());
>                 unset($aValues[array_search($sFile, $aValues)]);
>                 @unlink($this->getFullServerPath($sFile));
>                 $value = implode(",", $aValues);
>                 $this->setValue(implode(",", $aValues));
> 
>                 $tablename =
> $this->oForm->_navConf("/control/datahandler/tablename");
>                 $keyname =
> $this->oForm->_navConf("/control/datahandler/keyname");
>                 $entryid = $this->oForm->oDataHandler->_currentEntryId();
>                 $fieldname = $this->_getName();
>                 $value = $this->_getValue();
>                 @$GLOBALS['TYPO3_DB']->exec_UPDATEquery($tablename,
> $keyname . '="' . $entryid . '"', array($fieldname => $value));
>         }
> 
> I don't know if this is the better way to solve this.
> What is your opinion?
> 
> 
> Best regards,
>    Rego
> 


More information about the TYPO3-project-formidable mailing list