/**
  * action showForm
  *
  * @return void
  */
 public function validateFormAction()
 {
     $gpVars = $this->_GP;
     $type = $this->settings['tablename'];
     $settings = $this->settings[$type];
     $extName = $settings['extension'];
     $tmplPath = $settings['templatePath'];
     $uploads = array();
     // Validierung des Formulars
     // z.B. ... validation.personinfo.email = required,email
     $errorData = array();
     if ($ref = $settings['validation']) {
         foreach ($ref as $field => $types) {
             $types = $this->anyHelper->trimExplode(',', $types);
             foreach ($types as $type) {
                 $isMedia = $settings['media'][$field];
                 $checkfield = $isMedia ? $field . '_upload' : $field;
                 $fieldValue = $gpVars[$checkfield];
                 $altFieldValue = $gpVars[$field];
                 if ($isMedia && is_array($fieldValue) && isset($fieldValue['name'])) {
                     $fieldValue = $fieldValue['name'];
                 }
                 if (!$fieldValue && $altFieldValue) {
                     $fieldValue = $altFieldValue;
                 }
                 $validator = '\\Nng\\Nnfesubmit\\Validation\\' . ucfirst($type) . 'Validator';
                 if (class_exists($validator)) {
                     // Eigener Validator?
                     $checker = $this->objectManager->create($validator);
                     if ($errors = $checker->validate($fieldValue, $checkfield, $gpVars)->getErrors()) {
                         $errorData[$field][$type] = 1;
                         $errorData[$checkfield][$type] = 1;
                     }
                 } else {
                     // Typo3 interner Validator
                     $validator = '\\TYPO3\\CMS\\Extbase\\Validation\\Validator\\' . ucfirst($type) . 'Validator';
                     $checker = $this->objectManager->create($validator);
                     if ($errors = $checker->validate($fieldValue)->getErrors()) {
                         $errorData[$field][$type] = 1;
                         $errorData[$checkfield][$type] = 1;
                     }
                 }
             }
         }
     }
     // Spezieller Validator enthalten?
     $mapperName = '\\Nng\\Nnfesubmit\\Mapper\\' . \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($extName) . 'Mapper';
     if (class_exists($mapperName)) {
         $mapper = $this->objectManager->create($mapperName);
         \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($errorData, $mapper->validate($gpVars, $settings));
     }
     // Dateien hochgeladen?
     if ($files = $_FILES['tx_nnfesubmit_nnfesubmit']) {
         foreach ($files['name'] as $k => $file) {
             if ($files['size'][$k] > $this->settings['maxUploadFileSize'] * 1000) {
                 $errorData[$k]['filesize'] = 1;
             } else {
                 if (!$this->fileHelper->isForbidden($file) && !$errorData[$k]) {
                     $file = \TYPO3\CMS\Core\Utility\File\BasicFileUtility::cleanFileName(trim($file));
                     $unique_filename = $this->basicFileFunctions->getUniqueName($file, 'uploads/tx_nnfesubmit/');
                     if (\TYPO3\CMS\Core\Utility\GeneralUtility::upload_copy_move($files['tmp_name'][$k], $unique_filename)) {
                         $kn = $k;
                         if (substr($kn, -7) == '_upload') {
                             $kn = substr($kn, 0, -7);
                         }
                         $uploads[$kn] = basename($unique_filename);
                     }
                 } else {
                     if ($file) {
                         $errorData[$k]['invalid_filetype'] = 1;
                     }
                 }
             }
         }
     }
     $gpVars = array_merge($gpVars, $uploads);
     foreach ($gpVars as $k => $v) {
         $gpVars[$k] = $this->anyHelper->cleanTexteditorInput($v);
     }
     $this->view->assign('gp', $gpVars);
     $this->view->assign('errors', $errorData);
     $this->insertViewVariablesFromMapper($extName);
     $this->_GP = $gpVars;
     if ($errorData) {
         $this->view->setTemplatePathAndFilename($tmplPath . 'Form.html');
     } else {
         if ($settings['showConfirmationForm']) {
             $this->showConfirmationFormAction();
         } else {
             $this->finalizeAction();
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Handling files for group/select function
  *
  * @param array $valueArray Array of incoming file references. Keys are numeric, values are files (basically, this is the exploded list of incoming files)
  * @param array $tcaFieldConf Configuration array from TCA of the field
  * @param string $curValue Current value of the field
  * @param array $uploadedFileArray Array of uploaded files, if any
  * @param string $status 'update' or 'new' flag
  * @param string $table tablename of record
  * @param int $id UID of record
  * @param string $recFID Field identifier [table:uid:field] for flexforms
  * @return array Modified value array
  *
  * @throws \RuntimeException
  * @see checkValue_group_select()
  */
 public function checkValue_group_select_file($valueArray, $tcaFieldConf, $curValue, $uploadedFileArray, $status, $table, $id, $recFID)
 {
     // If file handling should NOT be bypassed, do processing:
     if (!$this->bypassFileHandling) {
         // If any files are uploaded, add them to value array
         // Numeric index means that there are multiple files
         if (isset($uploadedFileArray[0])) {
             $uploadedFiles = $uploadedFileArray;
         } else {
             // There is only one file
             $uploadedFiles = array($uploadedFileArray);
         }
         foreach ($uploadedFiles as $uploadedFileArray) {
             if (!empty($uploadedFileArray['name']) && $uploadedFileArray['tmp_name'] !== 'none') {
                 $valueArray[] = $uploadedFileArray['tmp_name'];
                 $this->alternativeFileName[$uploadedFileArray['tmp_name']] = $uploadedFileArray['name'];
             }
         }
         // Creating fileFunc object.
         if (!$this->fileFunc) {
             $this->fileFunc = GeneralUtility::makeInstance(BasicFileUtility::class);
             $this->include_filefunctions = 1;
         }
         // Setting permitted extensions.
         $all_files = array();
         $all_files['webspace']['allow'] = $tcaFieldConf['allowed'];
         $all_files['webspace']['deny'] = $tcaFieldConf['disallowed'] ?: '*';
         $all_files['ftpspace'] = $all_files['webspace'];
         $this->fileFunc->init('', $all_files);
     }
     // If there is an upload folder defined:
     if ($tcaFieldConf['uploadfolder'] && $tcaFieldConf['internal_type'] == 'file') {
         $currentFilesForHistory = null;
         // If filehandling should NOT be bypassed, do processing:
         if (!$this->bypassFileHandling) {
             // For logging..
             $propArr = $this->getRecordProperties($table, $id);
             // Get destrination path:
             $dest = $this->destPathFromUploadFolder($tcaFieldConf['uploadfolder']);
             // If we are updating:
             if ($status == 'update') {
                 // Traverse the input values and convert to absolute filenames in case the update happens to an autoVersionized record.
                 // Background: This is a horrible workaround! The problem is that when a record is auto-versionized the files of the record get copied and therefore get new names which is overridden with the names from the original record in the incoming data meaning both lost files and double-references!
                 // The only solution I could come up with (except removing support for managing files when autoversioning) was to convert all relative files to absolute names so they are copied again (and existing files deleted). This should keep references intact but means that some files are copied, then deleted after being copied _again_.
                 // Actually, the same problem applies to database references in case auto-versioning would include sub-records since in such a case references are remapped - and they would be overridden due to the same principle then.
                 // Illustration of the problem comes here:
                 // We have a record 123 with a file logo.gif. We open and edit the files header in a workspace. So a new version is automatically made.
                 // The versions uid is 456 and the file is copied to "logo_01.gif". But the form data that we sent was based on uid 123 and hence contains the filename "logo.gif" from the original.
                 // The file management code below will do two things: First it will blindly accept "logo.gif" as a file attached to the record (thus creating a double reference) and secondly it will find that "logo_01.gif" was not in the incoming filelist and therefore should be deleted.
                 // If we prefix the incoming file "logo.gif" with its absolute path it will be seen as a new file added. Thus it will be copied to "logo_02.gif". "logo_01.gif" will still be deleted but since the files are the same the difference is zero - only more processing and file copying for no reason. But it will work.
                 if ($this->autoVersioningUpdate === true) {
                     foreach ($valueArray as $key => $theFile) {
                         // If it is an already attached file...
                         if ($theFile === basename($theFile)) {
                             $valueArray[$key] = PATH_site . $tcaFieldConf['uploadfolder'] . '/' . $theFile;
                         }
                     }
                 }
                 // Finding the CURRENT files listed, either from MM or from the current record.
                 $theFileValues = array();
                 // If MM relations for the files also!
                 if ($tcaFieldConf['MM']) {
                     $dbAnalysis = $this->createRelationHandlerInstance();
                     /** @var $dbAnalysis RelationHandler */
                     $dbAnalysis->start('', 'files', $tcaFieldConf['MM'], $id);
                     foreach ($dbAnalysis->itemArray as $item) {
                         if ($item['id']) {
                             $theFileValues[] = $item['id'];
                         }
                     }
                 } else {
                     $theFileValues = GeneralUtility::trimExplode(',', $curValue, true);
                 }
                 $currentFilesForHistory = implode(',', $theFileValues);
                 // DELETE files: If existing files were found, traverse those and register files for deletion which has been removed:
                 if (!empty($theFileValues)) {
                     // Traverse the input values and for all input values which match an EXISTING value, remove the existing from $theFileValues array (this will result in an array of all the existing files which should be deleted!)
                     foreach ($valueArray as $key => $theFile) {
                         if ($theFile && !strstr(GeneralUtility::fixWindowsFilePath($theFile), '/')) {
                             $theFileValues = ArrayUtility::removeArrayEntryByValue($theFileValues, $theFile);
                         }
                     }
                     // This array contains the filenames in the uploadfolder that should be deleted:
                     foreach ($theFileValues as $key => $theFile) {
                         $theFile = trim($theFile);
                         if (@is_file($dest . '/' . $theFile)) {
                             $this->removeFilesStore[] = $dest . '/' . $theFile;
                         } elseif ($this->enableLogging && $theFile) {
                             $this->log($table, $id, 5, 0, 1, 'Could not delete file \'%s\' (does not exist). (%s)', 10, array($dest . '/' . $theFile, $recFID), $propArr['event_pid']);
                         }
                     }
                 }
             }
             // Traverse the submitted values:
             foreach ($valueArray as $key => $theFile) {
                 // Init:
                 $maxSize = (int) $tcaFieldConf['max_size'];
                 // Must be cleared. Else a faulty fileref may be inserted if the below code returns an error!
                 $theDestFile = '';
                 // a FAL file was added, now resolve the file object and get the absolute path
                 // @todo in future versions this needs to be modified to handle FAL objects natively
                 if (!empty($theFile) && MathUtility::canBeInterpretedAsInteger($theFile)) {
                     $fileObject = ResourceFactory::getInstance()->getFileObject($theFile);
                     $theFile = $fileObject->getForLocalProcessing(false);
                 }
                 // NEW FILES? If the value contains '/' it indicates, that the file
                 // is new and should be added to the uploadsdir (whether its absolute or relative does not matter here)
                 if (strstr(GeneralUtility::fixWindowsFilePath($theFile), '/')) {
                     // Check various things before copying file:
                     // File and destination must exist
                     if (@is_dir($dest) && (@is_file($theFile) || @is_uploaded_file($theFile))) {
                         // Finding size.
                         if (is_uploaded_file($theFile) && $theFile == $uploadedFileArray['tmp_name']) {
                             $fileSize = $uploadedFileArray['size'];
                         } else {
                             $fileSize = filesize($theFile);
                         }
                         // Check file size:
                         if (!$maxSize || $fileSize <= $maxSize * 1024) {
                             // Prepare filename:
                             $theEndFileName = isset($this->alternativeFileName[$theFile]) ? $this->alternativeFileName[$theFile] : $theFile;
                             $fI = GeneralUtility::split_fileref($theEndFileName);
                             // Check for allowed extension:
                             if ($this->fileFunc->checkIfAllowed($fI['fileext'], $dest, $theEndFileName)) {
                                 $theDestFile = $this->fileFunc->getUniqueName($this->fileFunc->cleanFileName($fI['file']), $dest);
                                 // If we have a unique destination filename, then write the file:
                                 if ($theDestFile) {
                                     GeneralUtility::upload_copy_move($theFile, $theDestFile);
                                     // Hook for post-processing the upload action
                                     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processUpload'])) {
                                         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processUpload'] as $classRef) {
                                             $hookObject = GeneralUtility::getUserObj($classRef);
                                             if (!$hookObject instanceof DataHandlerProcessUploadHookInterface) {
                                                 throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Core\\DataHandling\\DataHandlerProcessUploadHookInterface', 1279962349);
                                             }
                                             $hookObject->processUpload_postProcessAction($theDestFile, $this);
                                         }
                                     }
                                     $this->copiedFileMap[$theFile] = $theDestFile;
                                     clearstatcache();
                                     if ($this->enableLogging && !@is_file($theDestFile)) {
                                         $this->log($table, $id, 5, 0, 1, 'Copying file \'%s\' failed!: The destination path (%s) may be write protected. Please make it write enabled!. (%s)', 16, array($theFile, dirname($theDestFile), $recFID), $propArr['event_pid']);
                                     }
                                 } elseif ($this->enableLogging) {
                                     $this->log($table, $id, 5, 0, 1, 'Copying file \'%s\' failed!: No destination file (%s) possible!. (%s)', 11, array($theFile, $theDestFile, $recFID), $propArr['event_pid']);
                                 }
                             } elseif ($this->enableLogging) {
                                 $this->log($table, $id, 5, 0, 1, 'File extension \'%s\' not allowed. (%s)', 12, array($fI['fileext'], $recFID), $propArr['event_pid']);
                             }
                         } elseif ($this->enableLogging) {
                             $this->log($table, $id, 5, 0, 1, 'Filesize (%s) of file \'%s\' exceeds limit (%s). (%s)', 13, array(GeneralUtility::formatSize($fileSize), $theFile, GeneralUtility::formatSize($maxSize * 1024), $recFID), $propArr['event_pid']);
                         }
                     } elseif ($this->enableLogging) {
                         $this->log($table, $id, 5, 0, 1, 'The destination (%s) or the source file (%s) does not exist. (%s)', 14, array($dest, $theFile, $recFID), $propArr['event_pid']);
                     }
                     // If the destination file was created, we will set the new filename in the value array, otherwise unset the entry in the value array!
                     if (@is_file($theDestFile)) {
                         $info = GeneralUtility::split_fileref($theDestFile);
                         // The value is set to the new filename
                         $valueArray[$key] = $info['file'];
                     } else {
                         // The value is set to the new filename
                         unset($valueArray[$key]);
                     }
                 }
             }
         }
         // If MM relations for the files, we will set the relations as MM records and change the valuearray to contain a single entry with a count of the number of files!
         if ($tcaFieldConf['MM']) {
             /** @var $dbAnalysis RelationHandler */
             $dbAnalysis = $this->createRelationHandlerInstance();
             // Dummy
             $dbAnalysis->tableArray['files'] = array();
             foreach ($valueArray as $key => $theFile) {
                 // Explode files
                 $dbAnalysis->itemArray[]['id'] = $theFile;
             }
             if ($status == 'update') {
                 $dbAnalysis->writeMM($tcaFieldConf['MM'], $id, 0);
                 $newFiles = implode(',', $dbAnalysis->getValueArray());
                 list(, , $recFieldName) = explode(':', $recFID);
                 if ($currentFilesForHistory != $newFiles) {
                     $this->mmHistoryRecords[$table . ':' . $id]['oldRecord'][$recFieldName] = $currentFilesForHistory;
                     $this->mmHistoryRecords[$table . ':' . $id]['newRecord'][$recFieldName] = $newFiles;
                 } else {
                     $this->mmHistoryRecords[$table . ':' . $id]['oldRecord'][$recFieldName] = '';
                     $this->mmHistoryRecords[$table . ':' . $id]['newRecord'][$recFieldName] = '';
                 }
             } else {
                 $this->dbAnalysisStore[] = array($dbAnalysis, $tcaFieldConf['MM'], $id, 0);
             }
             $valueArray = $dbAnalysis->countItems();
         }
     } else {
         if (!empty($valueArray)) {
             // If filehandling should NOT be bypassed, do processing:
             if (!$this->bypassFileHandling) {
                 // For logging..
                 $propArr = $this->getRecordProperties($table, $id);
                 foreach ($valueArray as &$theFile) {
                     // FAL handling: it's a UID, thus it is resolved to the absolute path
                     if (!empty($theFile) && MathUtility::canBeInterpretedAsInteger($theFile)) {
                         $fileObject = ResourceFactory::getInstance()->getFileObject($theFile);
                         $theFile = $fileObject->getForLocalProcessing(false);
                     }
                     if ($this->alternativeFilePath[$theFile]) {
                         // If alternative File Path is set for the file, then it was an import
                         // don't import the file if it already exists
                         if (@is_file(PATH_site . $this->alternativeFilePath[$theFile])) {
                             $theFile = PATH_site . $this->alternativeFilePath[$theFile];
                         } elseif (@is_file($theFile)) {
                             $dest = dirname(PATH_site . $this->alternativeFilePath[$theFile]);
                             if (!@is_dir($dest)) {
                                 GeneralUtility::mkdir_deep(PATH_site, dirname($this->alternativeFilePath[$theFile]) . '/');
                             }
                             // Init:
                             $maxSize = (int) $tcaFieldConf['max_size'];
                             // Must be cleared. Else a faulty fileref may be inserted if the below code returns an error!
                             $theDestFile = '';
                             $fileSize = filesize($theFile);
                             // Check file size:
                             if (!$maxSize || $fileSize <= $maxSize * 1024) {
                                 // Prepare filename:
                                 $theEndFileName = isset($this->alternativeFileName[$theFile]) ? $this->alternativeFileName[$theFile] : $theFile;
                                 $fI = GeneralUtility::split_fileref($theEndFileName);
                                 // Check for allowed extension:
                                 if ($this->fileFunc->checkIfAllowed($fI['fileext'], $dest, $theEndFileName)) {
                                     $theDestFile = PATH_site . $this->alternativeFilePath[$theFile];
                                     // Write the file:
                                     if ($theDestFile) {
                                         GeneralUtility::upload_copy_move($theFile, $theDestFile);
                                         $this->copiedFileMap[$theFile] = $theDestFile;
                                         clearstatcache();
                                         if ($this->enableLogging && !@is_file($theDestFile)) {
                                             $this->log($table, $id, 5, 0, 1, 'Copying file \'%s\' failed!: The destination path (%s) may be write protected. Please make it write enabled!. (%s)', 16, array($theFile, dirname($theDestFile), $recFID), $propArr['event_pid']);
                                         }
                                     } elseif ($this->enableLogging) {
                                         $this->log($table, $id, 5, 0, 1, 'Copying file \'%s\' failed!: No destination file (%s) possible!. (%s)', 11, array($theFile, $theDestFile, $recFID), $propArr['event_pid']);
                                     }
                                 } elseif ($this->enableLogging) {
                                     $this->log($table, $id, 5, 0, 1, 'File extension \'%s\' not allowed. (%s)', 12, array($fI['fileext'], $recFID), $propArr['event_pid']);
                                 }
                             } elseif ($this->enableLogging) {
                                 $this->log($table, $id, 5, 0, 1, 'Filesize (%s) of file \'%s\' exceeds limit (%s). (%s)', 13, array(GeneralUtility::formatSize($fileSize), $theFile, GeneralUtility::formatSize($maxSize * 1024), $recFID), $propArr['event_pid']);
                             }
                             // If the destination file was created, we will set the new filename in the value array, otherwise unset the entry in the value array!
                             if (@is_file($theDestFile)) {
                                 // The value is set to the new filename
                                 $theFile = $theDestFile;
                             } else {
                                 // The value is set to the new filename
                                 unset($theFile);
                             }
                         }
                     }
                     if (!empty($theFile)) {
                         $theFile = GeneralUtility::fixWindowsFilePath($theFile);
                         if (GeneralUtility::isFirstPartOfStr($theFile, PATH_site)) {
                             $theFile = PathUtility::stripPathSitePrefix($theFile);
                         }
                     }
                 }
                 unset($theFile);
             }
         }
     }
     return $valueArray;
 }
 /**
  * Processing of files.
  * NOTICE: for now files can be handled only on creation of records. But a more advanced feature is that PREVIEW of files is handled.
  *
  * @param array $cmdParts Array with cmd-parts (from parseValues()). This will for example contain information about allowed file extensions and max size of uploaded files.
  * @param string $theField The fieldname with the files.
  *
  * @return void
  * @see parseValues()
  */
 protected function processFiles($cmdParts, $theField)
 {
     // First, make an array with the filename and file reference, whether the file is just uploaded or a preview
     $filesArr = [];
     if (is_string($this->dataArr[$theField])) {
         // files from preview.
         $tmpArr = explode(',', $this->dataArr[$theField]);
         foreach ($tmpArr as $val) {
             $valParts = explode('|', $val);
             $filesArr[] = ['name' => $valParts[1], 'tmp_name' => PATH_site . 'typo3temp/' . $valParts[0]];
         }
     } elseif (is_array($_FILES['FE'][$this->theTable][$theField]['name'])) {
         // Files from upload
         foreach ($_FILES['FE'][$this->theTable][$theField]['name'] as $kk => $vv) {
             if ($vv) {
                 $tmpFile = GeneralUtility::upload_to_tempfile($_FILES['FE'][$this->theTable][$theField]['tmp_name'][$kk]);
                 if ($tmpFile) {
                     $this->unlinkTempFiles[] = $tmpFile;
                     $filesArr[] = ['name' => $vv, 'tmp_name' => $tmpFile];
                 }
             }
         }
     } elseif (is_array($_FILES['FE']['name'][$this->theTable][$theField])) {
         // Files from upload
         foreach ($_FILES['FE']['name'][$this->theTable][$theField] as $kk => $vv) {
             if ($vv) {
                 $tmpFile = GeneralUtility::upload_to_tempfile($_FILES['FE']['tmp_name'][$this->theTable][$theField][$kk]);
                 if ($tmpFile) {
                     $this->unlinkTempFiles[] = $tmpFile;
                     $filesArr[] = ['name' => $vv, 'tmp_name' => $tmpFile];
                 }
             }
         }
     }
     // Then verify the files in that array; check existence, extension and size
     $this->dataArr[$theField] = '';
     $finalFilesArr = [];
     if (count($filesArr)) {
         $extArray = GeneralUtility::trimExplode(';', strtolower($cmdParts[1]), 1);
         $maxSize = intval($cmdParts[3]);
         foreach ($filesArr as $infoArr) {
             $fI = pathinfo($infoArr['name']);
             if (GeneralUtility::verifyFilenameAgainstDenyPattern($fI['name'])) {
                 if (!count($extArray) || in_array(strtolower($fI['extension']), $extArray)) {
                     $tmpFile = $infoArr['tmp_name'];
                     if (@is_file($tmpFile)) {
                         if (!$maxSize || filesize($tmpFile) < $maxSize * 1024) {
                             $finalFilesArr[] = $infoArr;
                         } elseif ($this->conf['debug']) {
                             debug('Size is beyond ' . $maxSize . ' kb (' . filesize($tmpFile) . ' bytes) and the file cannot be saved.');
                         }
                     } elseif ($this->conf['debug']) {
                         debug('Surprisingly there was no file for ' . $vv . ' in ' . $tmpFile);
                     }
                 } elseif ($this->conf['debug']) {
                     debug('Extension "' . $fI['extension'] . '" not allowed');
                 }
             } elseif ($this->conf['debug']) {
                 debug('Filename matched illegal pattern.');
             }
         }
     }
     // Copy the files in the resulting array to the proper positions based on preview/non-preview.
     $fileNameList = [];
     $uploadPath = '';
     foreach ($finalFilesArr as $infoArr) {
         if ($this->isPreview()) {
             // If the form is a preview form (and data is therefore not going into the database...) do this.
             $this->createFileFuncObj();
             $fI = pathinfo($infoArr['name']);
             $tmpFilename = $this->theTable . '_' . GeneralUtility::shortmd5(uniqid($infoArr['name'])) . '.' . $fI['extension'];
             $theDestFile = $this->fileFunc->getUniqueName($this->fileFunc->cleanFileName($tmpFilename), PATH_site . 'typo3temp/');
             GeneralUtility::upload_copy_move($infoArr['tmp_name'], $theDestFile);
             // Setting the filename in the list
             $fI2 = pathinfo($theDestFile);
             $fileNameList[] = $fI2['basename'] . '|' . $infoArr['name'];
         } else {
             $this->createFileFuncObj();
             if (is_array($GLOBALS['TCA'][$this->theTable]['columns'][$theField])) {
                 $uploadPath = $GLOBALS['TCA'][$this->theTable]['columns'][$theField]['config']['uploadfolder'];
             }
             if ($uploadPath !== '') {
                 $theDestFile = $this->fileFunc->getUniqueName($this->fileFunc->cleanFileName($infoArr['name']), PATH_site . $uploadPath);
                 GeneralUtility::upload_copy_move($infoArr['tmp_name'], $theDestFile);
                 // Setting the filename in the list
                 $fI2 = pathinfo($theDestFile);
                 $fileNameList[] = $fI2['basename'];
                 $this->filesStoredInUploadFolders[] = $theDestFile;
             }
         }
         // Implode the list of filenames
         $this->dataArr[$theField] = implode(',', $fileNameList);
     }
 }