[Typo3-dev] TCEmain Hook processing of uploaded files
Christoph Köpernick @ proSystem Media GmbH
christoph at psysm.com
Mon Sep 26 10:53:56 CEST 2005
Dear List members,
I´d like to preprocess uploaded files in a backend form. So I created a
hook, that works. But I got some problems with the names of uploaded
files.
My hook names the uploaded files (only images) in this scheme
myextkey_img_1.jpg
myextkey_img_2.jpg
...
by setting
$this->uploadedFileArray['myextkey'][$id]['my'.$k.'img']['name'] =
'myextkey_img_'.$k.'.jpg';
Also I want to save them into an extra directory for each $id:
$TCA[$table]['columns']['my'.$k.'img']['config']['uploadfolder'] .=
'/'.$id];
That works too.
But two strange cases occur:
1. If an image is already in the select field of the backend form. I
don´t click on the trash, browse for files on my PC and then submit the
form. The new selected image is saved with the postfix _01 and the old
image is still in the form.
-> Maybe a <select multiple=multiple> problem? But setting multiple=0 or
false in the TCA doesn´t make any effect. How can I get around this?
2. If an image is already in the select field of the backend form. I do
delete it by clicking on the trash, browse for a new image file on my PC
and submit. The old image is deleted and the new is saved with postfix
_01.
-> I´ve no idea how this happens. By looking in the source of tcemain, I
think the old file is deleted first and then the new file is saved (with
calling for a unique filename).
Now I´ve to delete, save the form, and then select the new to get the
right filenames and no problems. I´m using 3.7.0
I hope that somebody can help me or make some suggestions how to solve
that.
Best regards, Christoph Köpernick
More information about the TYPO3-dev
mailing list