[TYPO3-project-formidable] How to delete a file from a FILE renderlet?
Manuel Rego Casasnovas
mrego at igalia.com
Tue Jun 12 18:35:49 CEST 2007
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
--
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
Manuel Rego Casasnovas escribió:
> Hello everyone.
>
> I've used the FILE renderlet. It works well, with this renderlet I can
> upload files without any problems.
>
> But I'd like can delete the file that I upload.
> For example I upload a file called 'my_file.txt', and in my database
> record I have got a record field with this value. But when I upload
> another file, I'd like that the FILE renderlet remove the old file from
> my filesystem.
> Moreover I'd like have got an option to delete the file from my
> filesystem and from my database.
>
> Somebody have any idea?
>
> Thanks,
> Rego
>
>
More information about the TYPO3-project-formidable
mailing list