Issue Bug Closed

#66832Fileupload in a record fails with TCA for "exactly one file" (minitems/maxitems=1)

Stefan Neufeind 05/07/15, 13:00 updated 06/15/18, 23:51

Description

Worked with 4.5.x, issue after upgrading to 6.2.x.

Problem occurs when working in the backing with a self-created record-type, which has a file-upload-field like for example an image.

When the field already contains an image it was previously possible to replace that with a new image (“Browse”-button right in the field when editing the record). Doing so on 6.2.x gives a yellow warning-sign and the record cannot be saved.
The error is JavaScript-related (validity-check before form-submit).

Problem seems to be the TCA-setting “exactly one file” (minitems/maxitems=1). Setting minitems to 0 it works fine. I expect the problem might be that upon choosing a new field to upload the current element gets dropped and so the minitems-check fails – because temporarily the field has 0 entries but at the same time a new fild to be uploaded (which makes it 1 again).
Obviously it’s also not possible remove the file and saving the record before trying to upload a new one, since that would also violate the minitems-constraint.

TCA for field:
‘image’ => array (
‘exclude’ => 0,
‘label’ => ‘The image’,
‘config’ => array (
‘type’ => ‘group’,
‘internal_type’ => ‘file’,
‘allowed’ => $GLOBALS[‘TYPO3_CONF_VARS’][‘GFX’][‘imagefile_ext’],
‘max_size’ => $GLOBALS[‘TYPO3_CONF_VARS’][‘BE’][‘maxFileSize’],
‘uploadfolder’ => ‘uploads/tx_myext’,
‘show_thumbs’ => 1,
‘size’ => 1,
‘minitems’ => 1,
‘maxitems’ => 1,
)
),

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.