Apply effects to the uploaded file(s).

@see    FileProperty::fileUpload()
@param  array $fileData The file data to upload.
@return string
425441
public function fileUpload(array $fileData)
    {
        $target = parent::fileUpload($fileData);

        if ($this->applyEffects('upload')) {
            $target = $this->processEffects($target);
        }

        return $target;
    }
1282776
protected function getUpdateEvent($formData)
    {
        $event =  $this->getCreateOrUpdateEvent($formData);

        $event->setAddress($this->getExistingObject());

        return $event;
    }
190854
protected function getUpdateEvent($formData)
    {
        $event = new IndexEngineDriverConfigurationEvent();

        $event->setId($formData["id"]);
        $event->setCode($formData["code"]);
        $event->setDriverCode($formData["driver_code"]);
        $event->setTitle($formData["title"]);
        $event->setSerializedConfiguration($formData["serialized_configuration"]);

        return $event;
    }
673426
protected function getUpdateEvent($formData)
    {
        $event = new IndexEngineDriverConfigurationEvent();

        $event->setId($formData["id"]);
        $event->setTitle($formData["title"]);

        return $event;
    }
168503
public function actionUpload($type)
    {
        /** @var $loadFile \Symfony\Component\HttpFoundation\File\UploadedFile */
        $loadFile = App::$Request->files->get('upload');
        if ($loadFile === null || $loadFile->getError() !== 0)
            return $this->errorResponse(__('File upload failed'));

        // get file extension
        $fileExt = '.' . $loadFile->guessExtension();
        // check if this request type is allowed
        if ($this->allowedExt[$type] === null || !Any::isArray($this->allowedExt[$type]))
            throw new NativeException('Hack attempt');

        // check if this file extension is allowed to upload
        if (!Arr::in($fileExt, $this->allowedExt[$type])) {
            return $this->errorResponse(__('This file type is not allowed to upload'));
        }

        $date = Date::convertToDatetime(time(), 'd-m-Y');

        // create file hash based on name-size
        $fileNewName = App::$Security->simpleHash($loadFile->getFilename() . $loadFile->getSize()) . $fileExt;
        $savePath = Normalize::diskFullPath('/upload/' . $type . '/' . $date);
        // save file from tmp to regular
        $loadFile->move($savePath, $fileNewName);

        // generate URI of uploaded file
        $url = '/upload/' . $type . '/' . $date . '/' . $fileNewName;

        return App::$View->render('editor/load_success',
            [
                'callbackId' => (int)App::$Request->query->get('CKEditorFuncNum'),
                'url' => $url
            ],
            __DIR__);
    }
267241
public function process_cdata($cdata) {
        global $CFG;
        if ($cdata === '$@NULL@$') {  // Some cases we know we can skip complete processing
            return null;
        } else if ($cdata === '') {
            return '';
        } else if (is_numeric($cdata)) {
            return $cdata;
        } else if (strlen($cdata) < 32) { // Impossible to have one link in 32cc
            return $cdata;                // (http://10.0.0.1/file.php/1/1.jpg, http://10.0.0.1/mod/url/view.php?id=)
        } else if (strpos($cdata, '$@FILEPHP@$') === false) { // No $@FILEPHP@$, nothing to convert
            return $cdata;
        }

        if ($CFG->slasharguments) {
            $slash = '/';
            $forcedownload = '?forcedownload=1';
        } else {
            $slash = '%2F';
            $forcedownload = '&amp;forcedownload=1';
        }

        // We have to remove trailing slashes, otherwise file URLs will be restored with an extra slash.
        $basefileurl = rtrim(moodle_url::make_legacyfile_url($this->courseid, null)->out(true), $slash);
        // Decode file.php calls
        $search = array ("$@FILEPHP@$");
        $replace = array($basefileurl);
        $result = str_replace($search, $replace, $cdata);

        // Now $@SLASH@$ and $@FORCEDOWNLOAD@$ MDL-18799
        $search = array('$@SLASH@$', '$@FORCEDOWNLOAD@$');
        $replace = array($slash, $forcedownload);

        return str_replace($search, $replace, $result);
    }
1130623
public function getOneFile( string $fieldKey, $fileIndex = 0 ) : ProvidesUploadedFileData
	{
		$files = $this->getFiles( $fieldKey );

		return $files[ $fileIndex ] ?? new UploadedFile( '', '', '', 0, UPLOAD_ERR_NO_FILE );
	}
785144
public function add(Array $addData)
    {
        $addFields = array();
        $addValues = array();
        foreach ($addData as $key => $value) {
            $addFields[] = $key;
            $addValues[] = '\'' . $value . '\'';
        }
        $fields = implode(',', $addFields);
        $values = implode(',', $addValues);
        $this->sql = "INSERT INTO {$this->_table} ($fields)VALUES($values)";
        return $this->execute()->rowCount();
    }
422151
public static function createUploadableFile($config, $currentFilename = null, $newFileData = null)
    {
        $className = '\\PhpDevil\\framework\\base\\helpers\\files\\' . ucfirst($config['type']) . 'File';
        return new $className($config, $currentFilename, $newFileData);
    }
1298778
public function submissionSaveData(array $formData)
    {
        // remove empty values
        $formData = array_filter($formData);

        // get array of files to upload
        $files = [];
        foreach ($formData as $field => $value) {
            if (Request::hasFile($field)) {
                $files[$field] = Request::file($field);
                unset($formData[$field]);
            }
        }

        // save form submission
        $form_submission = new FormSubmission;
        $form_submission->form_block_id = $this->_block->id;
        $form_submission->content = serialize($formData);
        $form_submission->sent = 0;
        $form_submission->from_page_id = PageBuilder::pageId();
        $form_submission->save();
        $form_submission->uploadFiles($files);
        return $form_submission;
    }
609511
public function setFlatData(array $flatData)
    {
        $flatData = $this->setIdFromData($flatData);

        $data = [];
        $properties = $this->properties();
        foreach ($properties as $propertyIdent => $property) {
            $fields = $property->fields(null);
            foreach ($fields as $k => $f) {
                if (is_string($k)) {
                    $fid = $f->ident();
                    $key = str_replace($propertyIdent.'_', '', $fid);
                    if (isset($flatData[$fid])) {
                        $data[$propertyIdent][$key] = $flatData[$fid];
                        unset($flatData[$fid]);
                    }
                } else {
                    $fid = $f->ident();
                    if (isset($flatData[$fid])) {
                        $data[$propertyIdent] = $flatData[$fid];
                        unset($flatData[$fid]);
                    }
                }
            }
        }

        $this->setData($data);

        // Set remaining (non-property) data.
        if (!empty($flatData)) {
            $this->setData($flatData);
        }

        return $this;
    }
885256
private function uploadFile(UploadedFile $file)
    {
        /** @var FileStorage $fileStorage */
        $fileStorage = Yii::$app->get('fileStorage');

        $filename = $fileStorage->saveUploadedFile($file);

        return $fileStorage->put($filename, $file->name);
    }
1230120
public function addSource($filename, $source, $fileData)
    {
        $this->_sources[substr($filename, strlen($this->_phpdoctor->sourcePath()) + 1)] = array(
            $source, $fileData
        );
    }
324945
protected function getUpdateEvent($formData)
    {
        $orderStatusUpdateEvent = new OrderStatusUpdateEvent($formData['id']);

        $orderStatusUpdateEvent
            ->setLocale($formData['locale'])
            ->setTitle($formData['title'])
            ->setChapo($formData['chapo'])
            ->setDescription($formData['description'])
            ->setPostscriptum($formData['postscriptum'])
            ->setCode($formData['code'])
            ->setColor($formData['color'])
         ;

        return $orderStatusUpdateEvent;
    }
1304779
private function parseYaml($fileData)
    {
        return Yaml::parse(
            $fileData,
            Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE | Yaml::PARSE_OBJECT | Yaml::PARSE_CUSTOM_TAGS
        );
    }
646745
protected function _processFiles($post, $files)
    {
        if (!is_array($files)) {
            return $post;
        }
        $fileData = [];
        foreach ($files as $key => $value) {
            if ($value instanceof UploadedFileInterface) {
                $fileData[$key] = $value;
                continue;
            }

            if (is_array($value) && isset($value['tmp_name'])) {
                $fileData[$key] = $this->_createUploadedFile($value);
                continue;
            }

            throw new InvalidArgumentException(sprintf(
                'Invalid value in FILES "%s"',
                json_encode($value)
            ));
        }
        $this->uploadedFiles = $fileData;

        // Make a flat map that can be inserted into $post for BC.
        $fileMap = Hash::flatten($fileData);
        foreach ($fileMap as $key => $file) {
            $error = $file->getError();
            $tmpName = '';
            if ($error === UPLOAD_ERR_OK) {
                $tmpName = $file->getStream()->getMetadata('uri');
            }
            $post = Hash::insert($post, $key, [
                'tmp_name' => $tmpName,
                'error' => $error,
                'name' => $file->getClientFilename(),
                'type' => $file->getClientMediaType(),
                'size' => $file->getSize(),
            ]);
        }

        return $post;
    }
430238
public function upload(UploadedFile $file = null)
    {
        if ($file === null) {
            return '';
        }

        $fileName = $this->getFileName($file);
        $file->move($this->getTargetDir(), $fileName);

        return $fileName;
    }