[TYPO3-project-formidable] How to delete a file from a FILE renderlet?

Manuel Rego Casasnovas mrego at igalia.com
Wed Jun 13 10:58:31 CEST 2007


Hi Jerome,

I think that a link is a good option, I've already thank in this.

Only one thing about the text for the link, the text could be specified
in the XML config and we could use internationalization labels
(LLL:EXT:...).
<renderlet:FILE name="my_file_renderlet">
   <label>LLL:EXT:my_ext/locallang.xml:label</label>
   <clear_link>LLL:EXT:my_ext/locallang.xml:clear_link</clear_link>
   <data>
        <targetdir>/uploads/my_dir/</targetdir>
   </data>
</renderlet:FILE>

Finally I think that would be a good idea have a new label for the link
to use in the template, something like {my_file_renderlet.clear_link}.


Best regards,
   Rego

-- 
Manuel Rego Casasnovas
Computer Science Engineer
mailto:mrego at igalia.com
Tel: +34 986 10 76 10
Fax: +34 981 91 39 49
Igalia - http://www.igalia.com


Jerome Schneider escribió:
> Hello Manuel,
>
> For the moment rdt_file shamefuly lacks a button to clear the field in 
> the HTML and in the DB ...
>
> But there's clearly the need for such an obvious feature.
> How would you see this in the interface ? A link "Clear" next to the 
> file input ?
>
> Gimme the ideas !
> Jerome Schneider
>
>
> Manuel Rego Casasnovas a écrit :
>   
>> Hi.
>>
>> I've solved my first problem, I've modified the source code of the
>> _flatten function in the tx_rdtfile class, and add three lines:
>> ...
>>                 if(move_uploaded_file($tmp_name, $target)) {
>>                    
>>                     $this->oForm->_debug("moving from <b>[" . $tmp_name
>> . "]</b> to <b>[" . $target . "]</b>", "RDT FILE " . $this->_getName() .
>> " - FILE CORRECTLY UPLOADED AND STORED");
>>                     $sFile = $basename;
>>                    
>>                     // Lines added
>>                     $dFile =
>> $this->getFullServerPath(basename($mData["backup"]));
>>                     if(file_exists($dFile)) {
>>                         unlink($dFile);
>>                     }
>>                    
>>                 }
>> ...
>>
>> With this I delete the files, when I upload a new file.
>>
>> Only one problem now, delete a file without upload another file.
>>
>>
>> Bye,
>>    Rego
>>
>>
>>     
> _______________________________________________
> TYPO3-project-formidable mailing list
> TYPO3-project-formidable at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-formidable
>
>   


More information about the TYPO3-project-formidable mailing list