当前位置: 首页>>代码示例>>PHP>>正文


PHP GeneralUtility::upload_copy_move方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Core\Utility\GeneralUtility::upload_copy_move方法的典型用法代码示例。如果您正苦于以下问题:PHP GeneralUtility::upload_copy_move方法的具体用法?PHP GeneralUtility::upload_copy_move怎么用?PHP GeneralUtility::upload_copy_move使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Core\Utility\GeneralUtility的用法示例。


在下文中一共展示了GeneralUtility::upload_copy_move方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: migrateRecord

    /**
     * Processes the actual transformation from CSV to sys_file_references
     *
     * @param array $record
     * @return void
     */
    protected function migrateRecord(array $record)
    {
        $collections = array();
        $files = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $record['image'], TRUE);
        $descriptions = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('
', $record['imagecaption']);
        $titleText = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('
', $record['imagetitletext']);
        $i = 0;
        foreach ($files as $file) {
            if (file_exists(PATH_site . 'uploads/tx_cal/pics/' . $file)) {
                \TYPO3\CMS\Core\Utility\GeneralUtility::upload_copy_move(PATH_site . 'uploads/tx_cal/pics/' . $file, $this->targetDirectory . $file);
                $fileObject = $this->storage->getFile(self::FOLDER_ContentUploads . '/' . $file);
                //TYPO3 >= 6.2.0
                if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 6002000) {
                    $this->fileIndexRepository->add($fileObject);
                } else {
                    //TYPO3 6.1.0
                    $this->fileRepository->addToIndex($fileObject);
                }
                $dataArray = array('uid_local' => $fileObject->getUid(), 'tablenames' => $this->getRecordTableName(), 'uid_foreign' => $record['uid'], 'pid' => $record['pid'], 'fieldname' => 'image', 'sorting_foreign' => $i);
                if (isset($descriptions[$i])) {
                    $dataArray['description'] = $descriptions[$i];
                }
                if (isset($titleText[$i])) {
                    $dataArray['alternative'] = $titleText[$i];
                }
                $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_file_reference', $dataArray);
                unlink(PATH_site . 'uploads/tx_cal/pics/' . $file);
            }
            $i++;
        }
        $this->cleanRecord($record, $i, $collections);
    }
开发者ID:ulrikkold,项目名称:cal,代码行数:40,代码来源:AbstractImagesUpdateWizard.php

示例2: initAttachments

 /**
  * Converts HTML-array to an object
  * @param array $attachments
  * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
  */
 public function initAttachments(array $attachments)
 {
     /* @var \Mittwald\Typo3Forum\Domain\Model\Forum\Attachment */
     $objAttachments = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
     foreach ($attachments as $attachmentID => $attachment) {
         if ($attachment['name'] == '') {
             continue;
         }
         $attachmentObj = $this->objectManager->get('Mittwald\\Typo3Forum\\Domain\\Model\\Forum\\Attachment');
         $tmp_name = $_FILES['tx_typo3forum_pi1']['tmp_name']['attachments'][$attachmentID];
         $mime_type = mime_content_type($tmp_name);
         //Save in ObjectStorage and in file system
         $attachmentObj->setFilename($attachment['name']);
         $attachmentObj->setRealFilename(sha1($attachment['name'] . time()));
         $attachmentObj->setMimeType($mime_type);
         //Create dir if not exists
         $tca = $attachmentObj->getTCAConfig();
         $path = $tca['columns']['real_filename']['config']['uploadfolder'];
         if (!file_exists($path)) {
             mkdir($path, '0777', true);
         }
         //upload file and put in object storage
         $res = \TYPO3\CMS\Core\Utility\GeneralUtility::upload_copy_move($tmp_name, $attachmentObj->getAbsoluteFilename());
         if ($res === true) {
             $objAttachments->attach($attachmentObj);
         }
     }
     return $objAttachments;
 }
开发者ID:steffmeister,项目名称:typo3-forum,代码行数:34,代码来源:AttachmentService.php

示例3: execute

 /**
  * @return FlashMessage
  */
 public function execute()
 {
     $this->controller->headerMessage(LocalizationUtility::translate('moveDamRecordsToStorageCommand', 'dam_falmigration', array($this->storageObject->getName())));
     if (!$this->isTableAvailable('tx_dam')) {
         return $this->getResultMessage('damTableNotFound');
     }
     $this->fileIndexRepository = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\Index\\FileIndexRepository');
     $result = $this->execSelectNotMigratedDamRecordsQuery();
     $counter = 0;
     $total = $this->database->sql_num_rows($result);
     $this->controller->infoMessage('Found ' . $total . ' DAM records without a connection to a sys_file storage');
     $relativeTargetFolderBasePath = $this->storageBasePath . $this->targetFolderBasePath;
     while ($damRecord = $this->database->sql_fetch_assoc($result)) {
         $counter++;
         try {
             $relativeSourceFilePath = GeneralUtility::fixWindowsFilePath($this->getFullFileName($damRecord));
             $absoluteSourceFilePath = PATH_site . $relativeSourceFilePath;
             if (!file_exists($absoluteSourceFilePath)) {
                 throw new \RuntimeException('No file found for DAM record. DAM uid: ' . $damRecord['uid'] . ': "' . $relativeSourceFilePath . '"', 1441110613);
             }
             list($_, $directory) = explode('/', dirname($relativeSourceFilePath), 2);
             $relativeTargetFolder = $relativeTargetFolderBasePath . rtrim($directory, '/') . '/';
             $absoluteTargetFolder = PATH_site . $relativeTargetFolder;
             if (!is_dir($absoluteTargetFolder)) {
                 GeneralUtility::mkdir_deep($absoluteTargetFolder);
             }
             $basename = basename($relativeSourceFilePath);
             $absoluteTargetFilePath = $absoluteTargetFolder . $basename;
             if (!file_exists($absoluteTargetFilePath)) {
                 GeneralUtility::upload_copy_move($absoluteSourceFilePath, $absoluteTargetFilePath);
             } elseif (filesize($absoluteSourceFilePath) !== filesize($absoluteTargetFilePath)) {
                 throw new \RuntimeException('File already exists. DAM uid: ' . $damRecord['uid'] . ': "' . $relativeSourceFilePath . '"', 1441112138);
             }
             $fileIdentifier = substr($relativeTargetFolder, strlen($this->storageBasePath)) . $basename;
             $fileObject = $this->storageObject->getFile($fileIdentifier);
             $this->fileIndexRepository->add($fileObject);
             $this->updateDamFilePath($damRecord['uid'], $relativeTargetFolder);
             $this->amountOfMigratedRecords++;
         } catch (\Exception $e) {
             $this->setDamFileMissingByUid($damRecord['uid']);
             $this->controller->warningMessage($e->getMessage());
             $this->amountOfFilesNotFound++;
             continue;
         }
     }
     $this->database->sql_free_result($result);
     $this->controller->message('Not migrated dam records at start of task: ' . $total . '. Migrated files after task: ' . $this->amountOfMigratedRecords . '. Files not found: ' . $this->amountOfFilesNotFound . '.');
     return $this->getResultMessage();
 }
开发者ID:r3h6,项目名称:t3ext-dam_falmigration,代码行数:52,代码来源:MigrateToStorageService.php

示例4: uploadFile

 /**
  * Upload file from $_FILES['qqfile']
  *
  * @return string|bool false or filename like "file.png"
  */
 public static function uploadFile()
 {
     $files = self::getFilesArray();
     if (!is_array($files['qqfile'])) {
         return false;
     }
     if (empty($files['qqfile']['name']) || !self::checkExtension($files['qqfile']['name'])) {
         return false;
     }
     // create new filename and upload it
     $basicFileFunctions = self::getObjectManager()->get(BasicFileUtility::class);
     $filename = StringUtility::cleanString($files['qqfile']['name']);
     $newFile = $basicFileFunctions->getUniqueName($filename, GeneralUtility::getFileAbsFileName(self::getUploadFolderFromTca()));
     if (GeneralUtility::upload_copy_move($files['qqfile']['tmp_name'], $newFile)) {
         $fileInfo = pathinfo($newFile);
         return $fileInfo['basename'];
     }
     return false;
 }
开发者ID:olek07,项目名称:GiGaBonus,代码行数:24,代码来源:FileUtility.php

示例5: map

 function map($data, $settings)
 {
     $data = $this->mapToTCA($data, $settings);
     $media = $settings['media'];
     foreach ($media as $k => $path) {
         if ($data[$k]) {
             $basefile = basename($data[$k]);
             $unique_filename = $this->basicFileFunctions->getUniqueName(trim($basefile), $path);
             \TYPO3\CMS\Core\Utility\GeneralUtility::upload_copy_move('uploads/tx_nnfesubmit/' . $basefile, $unique_filename);
             if (file_exists($unique_filename)) {
                 //$this->anyHelper->addFlashMessage ( 'Media kopiert', 'Die Datei '.$data[$k].' wurde erfolgreich verschoben.', 'OK');
                 unlink('uploads/tx_nnfesubmit/' . $basefile);
                 $data[$k] = basename($unique_filename);
             } else {
                 $this->anyHelper->addFlashMessage('Datei nicht kopiert', 'Die Datei ' . $data[$k] . ' konnte nicht kopiert werden.', 'WARNING');
                 unset($data[$k]);
             }
         }
     }
     return $data;
 }
开发者ID:99grad,项目名称:TYPO3.Extbase.nnfesubmit,代码行数:21,代码来源:NnfilearchiveMapper.php

示例6: fileUpload

 /**
  * File Upload
  *
  * @param string $destinationPath
  * @param Mail $mail
  * @param string $fileExtensions allowed file extensions
  * @return bool
  */
 public static function fileUpload($destinationPath, Mail $mail, $fileExtensions = '')
 {
     $result = false;
     $files = self::getFilesArray();
     if (isset($files['tx_powermail_pi1']['tmp_name']['field']) && self::hasFormAnUploadField($mail->getForm())) {
         foreach (array_keys($files['tx_powermail_pi1']['tmp_name']['field']) as $marker) {
             foreach ($files['tx_powermail_pi1']['tmp_name']['field'][$marker] as $key => $tmpName) {
                 if (!empty($files['tx_powermail_pi1']['name']['field'][$marker][$key])) {
                     $uniqueFileName = self::getUniqueName($files['tx_powermail_pi1']['name']['field'][$marker][$key], $destinationPath);
                     if (self::checkExtension($uniqueFileName, $fileExtensions) && self::checkFolder($uniqueFileName)) {
                         $result = GeneralUtility::upload_copy_move($tmpName, $uniqueFileName);
                     }
                 }
             }
         }
     }
     return $result;
 }
开发者ID:VladStawizki,项目名称:ipl-logistik.de,代码行数:26,代码来源:BasicFileUtility.php

示例7: migrateFiles

 /**
  * Migrate files to sys_file_references
  *
  * @param array $record
  * @param string $field
  * @return void
  */
 protected function migrateFiles(array $record, $field)
 {
     $filesList = $record['tx_jhopengraphprotocol_ogimage'];
     $files = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $filesList, TRUE);
     if ($files) {
         foreach ($files as $file) {
             if (file_exists(PATH_site . 'uploads/tx_jhopengraphprotocol/' . $file)) {
                 \TYPO3\CMS\Core\Utility\GeneralUtility::upload_copy_move(PATH_site . 'uploads/tx_jhopengraphprotocol/' . $file, $this->targetDirectory . $file);
                 $fileObject = $this->storage->getFile(self::FOLDER_ContentUploads . '/' . $file);
                 $this->fileRepository->add($fileObject);
                 $dataArray = array('uid_local' => $fileObject->getUid(), 'tablenames' => 'pages', 'fieldname' => $field, 'uid_foreign' => $record['uid'], 'table_local' => 'sys_file', 'cruser_id' => self::CruserId, 'pid' => $record['pid'], 'sorting_foreign' => $record['sorting'], 'title' => $record['title']);
                 $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_file_reference', $dataArray);
             }
         }
     }
 }
开发者ID:kraemer-igroup,项目名称:ext-jh_opengraphprotocol,代码行数:23,代码来源:FalUpdateWizard.php

示例8: showFormStep3Action


//.........这里部分代码省略.........
     			$textProfile = '';
     		}
     
     
     		if(array_key_exists('flangeplate', $request)) {
     			$flangePlateUid = intval($this->request->getArgument('flangeplate'));
     			#var_dump($flangePlateUid);
     			$flangePlate = $this->flangePlateRepository->findByUid($flangePlateUid);
     			$textFlangePlate = 'FlangePlate: ' . $this->request->getArgument('flangeplate-count') . ' Stück ' . $flangePlate->getType() . "\n";
     
     			$this->view->assign('currentFlangePlate', $flangePlate);
     		} else {
     			$textFlangePlate = '';
     		}
     */
     $moredetails = '';
     if ($this->request->hasArgument('moredetails')) {
         if ($this->request->getArgument('moredetails') != '') {
             $comment = $this->request->getArgument('moredetails');
             $moredetails = 'Weitere Informationen: ' . "\n" . $comment . "\n";
         }
     }
     $angebot = 0;
     $angebotMessage = '';
     if ($this->request->hasArgument('angebot')) {
         if ($this->request->getArgument('angebot') == '1') {
             $angebotMessage = 'Kunde wünscht ein Angebot';
         }
     }
     if ($_FILES['tx_winkelproducts_pi1']['name']['flangeplate-pdf'] != '') {
         $flangeplatePdf = 'Anhang vorhanden' . "\n";
         #var_dump($_FILES);
         $basicFileFunctions = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_basicFileFunctions');
         $fileName = $basicFileFunctions->getUniqueName($_FILES['tx_winkelproducts_pi1']['name']['flangeplate-pdf'], \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('uploads/tx_winkelproducts/'));
         $mimeType = $_FILES['tx_winkelproducts_pi1']['type']['flangeplate-pdf'];
         \TYPO3\CMS\Core\Utility\GeneralUtility::upload_copy_move($_FILES['tx_winkelproducts_pi1']['tmp_name']['flangeplate-pdf'], $fileName);
         $pdf = basename($fileName);
         #var_dump($fileName);
     } else {
         $flangeplatePdf = 'Kein Anhang' . "\n";
     }
     # $error = TRUE;
     $this->view->assign('bearing', $bearing);
     $this->view->assign('error', $error);
     if ($error === TRUE) {
         // @todo Errormeldungen setzen
         $request['firstName'] = $this->request->getArgument('firstName');
         $request['lastName'] = $this->request->getArgument('lastName');
         $request['cadFormat'] = $this->request->getArgument('cadFormat');
         $request['angebot'] = $this->request->getArgument('angebot');
         $request['bearing-count'] = $this->request->getArgument('bearing-count');
         $request['flangeplate-count'] = $this->request->getArgument('flangeplate-count');
         $request['cadDownloadUrl'] = $this->request->getArgument('cadDownloadUrl');
         if ($this->request->getArgument('newsletter') == '1') {
             $request['newsletterChecked'] = TRUE;
         } else {
             $request['newsletterChecked'] = FALSE;
         }
         if ($this->request->getArgument('angebot') == '1') {
             $request['angebotChecked'] = TRUE;
         } else {
             $request['angebotChecked'] = FALSE;
         }
         $this->view->assign('request', $request);
     } else {
         //			DebuggerUtility::var_dump($bearing, 'Bearing');
         /** @var \Winkel\WinkelCustomerlog\Domain\Model\CustomerData */
         $customerData = $this->objectManager->get('\\Winkel\\WinkelCustomerlog\\Domain\\Model\\CustomerData');
         $xIP = (string) getenv('HTTP_X_FORWARDED_FOR');
         $ip = (string) getenv('REMOTE_ADDR');
         if ($xIP != '') {
             $ip = $xIP;
         }
         $customerData->setIp($ip);
         $language = $GLOBALS['TSFE']->config['config']['language'];
         $customerData->setLanguage($language);
         $customerData->setPid('2057');
         $requestType = $this->requestTypeRepository->findByUid(2);
         $customerData->setRequestType($requestType);
         $customerData->setFirstName($firstName);
         $customerData->setLastName($lastName);
         $customerData->setCompany($companyName);
         $customerData->setComment($moredetails);
         $customerData->setEmail($email);
         $customerData->setTelephone($phone);
         $customerData->setArticleNumber($bearing->getArticleNumber());
         $customerData->setArticleTitle($bearing->getTitleShow());
         $customerData->setArticleCadFormat($cadFormat);
         $customerData->setCadDownloadUrl($cadDownloadUrl);
         #DebuggerUtility::var_dump($customerData);
         $message = 'WINKEL-Rolle: ' . $bearing->getTitleShow() . "\n" . '==========================' . "\n" . $this->request->getArgument('bearing-count') . ' Stück ' . "\n\n" . $textProfile . $textFlangePlate . $flangeplatePdf . '-------------------------------------' . "\n" . $moredetails . "\n" . '-------------------------------------' . "\n" . \Winkel\UserWebsite\Utilities\BuildAddressTextFromRequestObject::plainText($this->request) . 'Download-URL: ' . $cadDownloadUrl . "\n" . $angebotMessage;
         $customerData->setRaw($message);
         $subject = '[Produktanfrage Rolle] von ' . $companyName . ' (' . $firstName . ' ' . $lastName . ')';
         \Winkel\UserWebsite\Utilities\SendMail::sendMailToAdmin($subject, $message);
         \Winkel\UserWebsite\Utilities\SendMail::sendMailToWinkel($subject, $message);
         // Daten in der Extension CustomerLog speichern
         $this->customerDataRepository->add($customerData);
         $this->persistenceManager->persistAll();
     }
 }
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:101,代码来源:BearingController.php

示例9: setImage

 /**
  * Sets the image
  *
  * @param \array $image
  * @return void
  */
 public function setImage(array $image)
 {
     if (!empty($image['name'])) {
         // image name
         $imageName = $image['name'];
         // temporary name (incl. path) in upload directory
         $imageTempName = $image['tmp_name'];
         $basicFileUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\File\\BasicFileUtility');
         // determining a unique namens (incl. path) in
         // uploads/tx_simpleblog/ and copy file
         $imageNameNew = $basicFileUtility->getUniqueName($imageName, \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('uploads/tx_simpleblog/'));
         \TYPO3\CMS\Core\Utility\GeneralUtility::upload_copy_move($imageTempName, $imageNameNew);
         // set name without path
         $this->image = basename($imageNameNew);
     }
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:22,代码来源:Blog.php

示例10: processUploadedFile

 /**
  * @param string $fieldName
  * @return NULL|string
  * @throws FileTooLargeException
  * @throws FilePartiallyUploadedException
  * @throws NoFileUploadedException
  * @throws InvalidExtensionException
  */
 public function processUploadedFile($fieldName)
 {
     if (!array_key_exists($fieldName, $this->files)) {
         return NULL;
     }
     $file = $this->files[$fieldName];
     switch ($file['error']) {
         case UPLOAD_ERR_INI_SIZE:
         case UPLOAD_ERR_FORM_SIZE:
             new FileTooLargeException();
         case UPLOAD_ERR_PARTIAL:
             new FilePartiallyUploadedException();
         case UPLOAD_ERR_NO_FILE:
             new NoFileUploadedException();
     }
     if (!$this->isAllowed($file['name'])) {
         throw new InvalidExtensionException('invalid file extension', 0, NULL, $this->allowedExtensions);
     }
     $basicFileFunctions = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\File\\BasicFileUtility');
     $fileName = $basicFileFunctions->getUniqueName($file['name'], $this->uploadFolder);
     GeneralUtility::upload_copy_move($file['tmp_name'], $fileName);
     return 'uploads/tx_t3chimp/' . basename($fileName);
 }
开发者ID:BjoBre,项目名称:t3chimp,代码行数:31,代码来源:FileUpload.php

示例11: generateHighDensityGraphic

 /**
  * The actual sprite generator, renders the command for IM/GM and executes
  *
  * @return void
  */
 protected function generateHighDensityGraphic()
 {
     $tempSprite = GeneralUtility::tempnam($this->spriteName . '@x2', '.png');
     $filePath = PATH_site . $this->spriteFolder . $this->spriteName . '@x2.png';
     // Create black true color image with given size
     $newSprite = imagecreatetruecolor($this->spriteWidth * 2, $this->spriteHeight * 2);
     imagesavealpha($newSprite, TRUE);
     // Make it transparent
     imagefill($newSprite, 0, 0, imagecolorallocatealpha($newSprite, 0, 255, 255, 127));
     foreach ($this->iconsData as $icon) {
         $function = 'imagecreatefrom' . strtolower($icon['fileExtension']);
         if (function_exists($function)) {
             if ($icon['fileNameHighDensity'] !== FALSE) {
                 // copy HighDensity file
                 $currentIcon = $function($icon['fileNameHighDensity']);
                 imagecopy($newSprite, $currentIcon, $icon['left'] * 2, $icon['top'] * 2, 0, 0, $icon['width'] * 2, $icon['height'] * 2);
             } else {
                 // scale up normal file
                 $currentIcon = $function($icon['fileName']);
                 imagecopyresized($newSprite, $currentIcon, $icon['left'] * 2, $icon['top'] * 2, 0, 0, $icon['width'] * 2, $icon['height'] * 2, $icon['width'], $icon['height']);
             }
         }
     }
     imagepng($newSprite, $tempSprite);
     GeneralUtility::upload_copy_move($tempSprite, $filePath);
     GeneralUtility::unlink_tempfile($tempSprite);
 }
开发者ID:adrolli,项目名称:TYPO3.CMS,代码行数:32,代码来源:SpriteGenerator.php

示例12: upload_copy_move

 /**
  * wrapper for GeneralUtility::writeFile
  * checks for overwrite settings
  *
  * @param string $targetFile the path and filename of the targetFile
  * @param string $fileContents
  */
 protected function upload_copy_move($sourceFile, $targetFile)
 {
     $overWriteMode = RoundTrip::getOverWriteSettingForPath($targetFile, $this->extension);
     if ($overWriteMode === -1) {
         // skip creation
         return;
     }
     if (!file_exists($targetFile) || $this->roundTripEnabled && $overWriteMode < 2) {
         GeneralUtility::upload_copy_move($sourceFile, $targetFile);
     }
 }
开发者ID:maab127,项目名称:default7,代码行数:18,代码来源:FileGenerator.php

示例13: migrateFilesToFal

 /**
  * Processes the actual transformation from CSV to sys_file_references
  *
  * @param array $source
  * @param array $destination
  * @param array $configuration
  *
  * @return void
  */
 protected function migrateFilesToFal(array $source, array $destination, array $configuration)
 {
     $path = PATH_site . $configuration['sourcePath'];
     $files = GeneralUtility::trimExplode(',', $source[$configuration['sourceField']], true);
     $i = 1;
     foreach ($files as $file) {
         if (file_exists($path . $file)) {
             GeneralUtility::upload_copy_move($path . $file, $this->targetDirectory . $file);
             /** @var \TYPO3\CMS\Core\Resource\File $fileObject */
             $fileObject = $this->storage->getFile(self::FILE_MIGRATION_FOLDER . $file);
             $this->fileIndexRepository->add($fileObject);
             $count = $this->database->exec_SELECTcountRows('*', 'sys_file_reference', 'tablenames = ' . $this->database->fullQuoteStr($configuration['destinationTable'], 'sys_file_reference') . ' AND fieldname = ' . $this->database->fullQuoteStr($configuration['destinationField'], 'sys_file_reference') . ' AND uid_local = ' . $fileObject->getUid() . ' AND uid_foreign = ' . $destination['uid']);
             if (!$count) {
                 $dataArray = array('uid_local' => $fileObject->getUid(), 'tablenames' => $configuration['destinationTable'], 'uid_foreign' => $destination['uid'], 'pid' => $source['pid'], 'fieldname' => $configuration['destinationField'], 'sorting_foreign' => $i, 'table_local' => 'sys_file');
                 $this->database->exec_INSERTquery('sys_file_reference', $dataArray);
             }
         }
         $i++;
     }
 }
开发者ID:evoWeb,项目名称:store_finder,代码行数:29,代码来源:UpdateUtility.php

示例14: feeditAction

 /**
  * action feeditAction
  * Bearbeiten eines bestehenden Datensatzes aus fremder Tabelle starten. 
  * Dazu Kopie in tx_nnfesubmit_domain_model_entry anlegen und zum Formular weiterleiten
  *
  * @return array
  */
 public function feeditAction($params)
 {
     $this->settings = $this->settingsUtility->getSettings();
     $uid = intval($params['uid']);
     $type = $params['type'];
     $settings = $this->settings[$type];
     $extName = $settings['extension'];
     // Prüfen, ob Datensatz in fremder Tabelle exisitert
     if (!($data = $this->tableService->getEntry($settings, $uid))) {
         return $this->anyHelper->addFlashMessage('Kein Eintrag gefunden', "In der Tabelle {$settings['tablename']} wurde kein Datensatz mit der uid={$uid} gefunden.", 'ERROR');
     }
     // Datensatz zum Bearbeiten anlegen
     if (!($entry = $this->entryRepository->getEntryForExt($uid, $type))) {
         $entry = $this->objectManager->get('\\Nng\\Nnfesubmit\\Domain\\Model\\Entry');
         $this->entryRepository->add($entry);
         $this->persistenceManager->persistAll();
         //$unique_filename = $this->basicFileFunctions->getUniqueName($file, 'uploads/tx_nnfesubmit/');
         //if (\TYPO3\CMS\Core\Utility\GeneralUtility::upload_copy_move($files['tmp_name'][$k], $unique_filename)) {
     }
     // Media zurück in den Ordner uploads/tx_nnfesubmit kopieren
     $media = $settings['media'];
     foreach ($media as $k => $path) {
         if ($data[$k]) {
             $unique_filename = $this->basicFileFunctions->getUniqueName(trim(basename($data[$k])), 'uploads/tx_nnfesubmit/');
             \TYPO3\CMS\Core\Utility\GeneralUtility::upload_copy_move($path . $data[$k], $unique_filename);
             if (!file_exists($unique_filename)) {
                 $this->anyHelper->addFlashMessage('Datei nicht kopiert', 'Die Datei ' . $data[$k] . ' konnte nicht kopiert werden.', 'WARNING');
             }
         }
     }
     //$entry->setFeUser( $GLOBALS['TSFE']->fe_user->user['uid'] );
     $entry->setCruserId($GLOBALS['TSFE']->fe_user->user['uid']);
     $entry->setSrcuid($uid);
     $entry->setExt($type);
     $entry->setData(json_encode($data));
     $this->entryRepository->update($entry);
     $this->persistenceManager->persistAll();
     $entryUid = $entry->getUid();
     $newAdminKey = '';
     if ($params['adminKey'] && $this->anyHelper->validateKeyForUid($uid, $params['adminKey'], 'admin')) {
         $newAdminKey = $this->anyHelper->createKeyForUid($entryUid, 'admin');
     }
     //http://adhok.99grad.de/index.php?id=17&id=17&nnf%5B193%5D%5Buid%5D=3&cHash=f14da214fc18a7f53b4da7342f3abe64&eID=nnfesubmit&action=feedit&type=nnfilearchive&uid=21&key=02bc7442
     $this->anyHelper->httpRedirect($settings['editPid'], array('nnf' => $params['nnf'], 'tx_nnfesubmit_nnfesubmit[key]' => $this->anyHelper->createKeyForUid($entryUid), 'tx_nnfesubmit_nnfesubmit[adminKey]' => $newAdminKey, 'tx_nnfesubmit_nnfesubmit[entry]' => $entryUid, 'tx_nnfesubmit_nnfesubmit[pluginUid]' => intval($params['pluginUid']), 'tx_nnfesubmit_nnfesubmit[returnUrl]' => $params['returnUrl']));
     //		\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($entry);
     //		$this->editAction( $entry->getUid() );
     die;
 }
开发者ID:99grad,项目名称:TYPO3.Extbase.nnfesubmit,代码行数:55,代码来源:MainController.php

示例15: uploadFile

 /**
  * Upload file from $_FILES['qqfile']
  *
  * @return mixed false or filename like "file.png"
  */
 public function uploadFile()
 {
     if (!is_array($_FILES['qqfile'])) {
         return FALSE;
     }
     if (empty($_FILES['qqfile']['name']) || !self::checkExtension($_FILES['qqfile']['name'])) {
         return FALSE;
     }
     // create new filename and upload it
     $basicFileFunctions = $this->objectManager->get('TYPO3\\CMS\\Core\\Utility\\File\\BasicFileUtility');
     $filename = $this->cleanFileName($_FILES['qqfile']['name']);
     $newFile = $basicFileFunctions->getUniqueName($filename, GeneralUtility::getFileAbsFileName(self::getUploadFolderFromTca()));
     if (GeneralUtility::upload_copy_move($_FILES['qqfile']['tmp_name'], $newFile)) {
         $fileInfo = pathinfo($newFile);
         return $fileInfo['basename'];
     }
     return FALSE;
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:23,代码来源:Div.php


注:本文中的TYPO3\CMS\Core\Utility\GeneralUtility::upload_copy_move方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。