Called when file upload started
@param  Input $in Input buffer
@return void
4333
public function onUploadFileStart($in)
    {
        $this->freezeInput();
        FileSystem::tempnam(ini_get('upload_tmp_dir'), 'php', function ($fp) use ($in) {
            if (!$fp) {
                $in->curPart['fp'] = false;
                $in->curPart['error'] = UPLOAD_ERR_NO_TMP_DIR;
            } else {
                $in->curPart['fp'] = $fp;
                $in->curPart['tmp_name'] = $fp->path;
            }
            $this->unfreezeInput();
        });
    }
864580
protected function _validator_upload($input, $value) {
		if (!is_array($value)) return false;
		if (count($value) !== 5) return false;

		$fields = ['name', 'type', 'tmp_name', 'error', 'size'];
		if (array_keys($value) !== $fields) return false;

		if ($value['error'] !== '0') return false;

		if (!is_uploaded_file($value['tmp_name'])) return false;

		return true;
	}
192384
public static function process($config = array())
	{
		foreach (static::$upload->getAllFiles() as $file)
		{
			$file->setConfig($config);
			$file->validate();
		}
	}
190681
public function upload()
    {
        if ($newFile = $this->getNewFileName()){
            $origin = $destination = \Devil::getPathOf($this->config['dest']);
            $this->remove();
            if (isset($this->config['onload'])) {
                $destination .= '/origin';
            }
            if (!is_dir($destination)) mkdir ($destination, 0777, true);
            $realFileName = $destination . '/' . $this->_primaryKey . '_' . $this->getNewFileName();
            if (move_uploaded_file($this->uploaded['tmp_name'], $realFileName)) {
                if (isset($this->config['onload'])) foreach ($this->config['onload'] as $method=>$config) {
                    $this->$method($realFileName, $origin, $config, $this->_primaryKey . '_' . $this->getNewFileName());
                }
            }
        }
    }
283853
protected function init()
    {
        if(!\extension_loaded('inotify'))
        {
            throw new \RuntimeException('the extension inotify is not installed');
        }
        $this->handler = \inotify_init();
        stream_set_blocking($this->handler, 0);

        $this->excludeRule = implode('|', array_map('\Imi\Util\Imi::parseRule', $this->excludePaths));
        foreach($this->includePaths as $path)
        {
            \inotify_add_watch($this->handler, $path, $this->mask);
            $directory = new \RecursiveDirectoryIterator($path, \FilesystemIterator::KEY_AS_PATHNAME | \FilesystemIterator::CURRENT_AS_FILEINFO);
            $iterator = new \RecursiveIteratorIterator($directory);
            if('' === $this->excludeRule)
            {
                foreach($iterator as $fileName => $fileInfo)
                {
                    $filePath = dirname($fileName);
                    if(!isset($this->paths[$filePath]))
                    {
                        $this->paths[$filePath] = \inotify_add_watch($this->handler, $filePath, $this->mask);
                    }
                }
            }
            else
            {
                $rule = "/^(?!{$this->excludeRule}).+$/i";
                $regex = new \RegexIterator($iterator, $rule, \RecursiveRegexIterator::GET_MATCH);
                foreach ($regex as $item)
                {
                    $filePath = dirname($item[0]);
                    if(!isset($this->paths[$filePath]))
                    {
                        $this->paths[$filePath] = \inotify_add_watch($this->handler, $filePath, $this->mask);
                    }
                }
            }
        }
    }
1046508
public function init() {
		$htmlId = $this->fileUploadControl->getHtmlId();
		
		foreach($this->elements as $type => $value) {
			if($type == "input") {
				$element = Html::el("input type='file' multiple='multiple'")->addAttributes([
					"id" => $htmlId,
					"name" => $this->fileUploadControl->getHtmlName(),
					"data-upload-component" => $htmlId
				]);
			} else if($type == "delete") {
				$element = Html::el("button type='button'")->addAttributes([
					"data-upload-component" => sprintf($this->idTemplate, $htmlId, $type)
				]);
			} else if($type == "imagePreview") {
				$element = Html::el("img")->addAttributes([
					"data-upload-component" => sprintf($this->idTemplate, $htmlId, $type)
				]);
			} else {
				$element = Html::el("div")->addAttributes([
					"data-upload-component" => sprintf($this->idTemplate, $htmlId, $type)
				]);
			}
			
			$this->elements[ $type ] = $element;
		}
	}
524155
public function input($file_content)
    {
        $this->file_content = $file_content;

        $this->parsed_content = (array) SymfonyYaml::parse($this->file_content);
    }
930585
protected function onInput($data)
    {
        //Process data here
        foreach ($this->params as $column) {
            if ($this->character_mask) {
                $data[$column] = trim($data[$column], $this->character_mask);
            } else {
                $data[$column] = trim($data[$column]);
            }
        }
        $this->next($data);
    }
611104
private function activateCheckMode(InputInterface $input)
    {
        $this->check = $input->getOption('check');
        $this->start = microtime(true);
    }
766340
public function setStarted($value)
    {
        $this->_validateDate('Started', $value);

        if ($this->data['started'] === $value) {
            return;
        }

        $this->data['started'] = $value;

        $this->_setModified('started');
    }
101005
protected function onInput($data)
    {
        //Process data here
        foreach ($this->params as $column) {
            unset($data[$column]);
        }
        $this->next($data);
    }
650207
protected function _initTransaction ($inputs, $debut) {
        try {
            if($this->transactionRecord == 1){
                $params = new SimpleObject\OdaPrepareReqSql();
                $params->sql = "INSERT INTO  `api_tab_transaction` (
                    `id` ,
                    `type` ,
                    `statut` ,
                    `input` ,
                    `output` ,
                    `debut` ,
                    `fin`
                    )
                    VALUES (
                    NULL ,  :type,  'debut',  :input,  '',  :debut,  ''
                    )
                ;";
                $strJsonInput = OdaLib::fomatage_json($inputs);
                $params->typeSQL = OdaLibBd::SQL_INSERT_ONE;
                $params->bindsValue = [
                    "type" => [ "value" => $_SERVER["SCRIPT_FILENAME"]]
                    , "input" => [ "value" => $strJsonInput]
                    , "debut" => [ "value" => $debut->getDateTimeWithMili()]
                ];
                $retour = $this->BD_ENGINE->reqODASQL($params);
                $this->object_retour->id_transaction = $retour->data;
            }else{
                $this->object_retour->id_transaction = 0;
            }

        } catch (Exception $ex) {
            $this->dieInError($ex.'');
        }
    }
31739
private static function input()
    {
        $files = ['Input'];
        $folder = static::$root.'Http'.'/';

        self::call($files, $folder);

        Input::register();
    }
1113915
public function setInput($input)
    {
        $this->input        = $input;
        $this->currentInput = $input;
        $this->currentPos   = 0;
        $this->currentToken = null;
    }
1362478
public function upload()
    {
        //as upload may be called multiple times, we remove the session lock as soon as possible
        try{
            session_write_close();
            if ($this->hasRequestParameter('uri')) {
                $itemUri = $this->getRequestParameter('uri');
                $item = $this->getResource($itemUri);
            }

            if ($this->hasRequestParameter('lang')) {
                $itemLang = $this->getRequestParameter('lang');
            }

            if (!$this->hasRequestParameter('path')) {
                throw new common_exception_MissingParameter('path', __METHOD__);
            }

            if (!$this->hasRequestParameter('filters')) {
                throw new common_exception_MissingParameter('filters', __METHOD__);
            }
            $filters = $this->getRequestParameter('filters');

            $resolver = new ItemMediaResolver($item, $itemLang);
            $asset = $resolver->resolve($this->getRequestParameter('relPath'));

            $file = tao_helpers_Http::getUploadedFile('content');
            $fileTmpName = $file['tmp_name'].'_'.$file['name'];

            if (!tao_helpers_File::copy($file['tmp_name'], $fileTmpName)) {
                throw new common_exception_Error('impossible to copy '.$file['tmp_name'].' to '.$fileTmpName);
            }

            $mime = \tao_helpers_File::getMimeType($fileTmpName);
            if (is_string($filters)) {
                // the mime type is part of the $filters
                $filters = explode(',', $filters);
                if ((in_array($mime, $filters))) {
                    $filedata = $asset->getMediaSource()->add($fileTmpName, $file['name'],
                        $asset->getMediaIdentifier());
                } else {
                    throw new FileUploadException(__('The file you tried to upload is not valid'));
                }
            } else {
                $valid = false;
                // OR the extension is part of the filter and it correspond to the mime type
                foreach ($filters as $filter) {
                    if ($filter['mime'] === $mime &&
                        (!isset($filter['extension']) || $filter['extension'] === \tao_helpers_File::getFileExtention($fileTmpName))
                    ) {
                        $valid = true;
                    }
                }
                if ($valid) {
                    $filedata = $asset->getMediaSource()->add($fileTmpName, $file['name'],
                        $asset->getMediaIdentifier());
                } else {
                    throw new FileUploadException(__('The file you tried to upload is not valid'));
                }
            }

            $this->returnJson($filedata);
            return;
        }
        catch(PermissionException $e){
            $message = $e->getMessage();
        }
        catch(FileUploadException $e){
            $message = $e->getMessage();
        }
        catch(common_Exception $e){
            $this->logWarning($e->getMessage());
            $message = _('Unable to upload file');
        }
        $this->returnJson(array('error' => $message));

    }
404069
public static function empty($in_p=null)
    {
        $flag = false;
        //check if the input is an array
        if (is::ary($in_p)) {
            if (array_key_exists('error', $in_p)) {
                if ($in_p['error'] === UPLOAD_ERR_NO_FILE) {
                    $flag = true;
                } //if $_FILES is empty
            } elseif (empty($in_p)) {
                $flag = true; //if array as whole is empty
            }
        } else {//if the input is a string
            if (empty($in_p)) {
                $flag = true;
            } //if str is empty
        }
        return $flag;
    }
972214
public function init()
    {
        $this->attachBehavior('ywplugin', array('class' => 'yiiwheels.behaviors.WhPlugin'));

        if ($this->uploadTemplate === null) {
            $this->uploadTemplate = "#template-upload";
        }

        if ($this->downloadTemplate === null) {
            $this->downloadTemplate = "#template-download";
        }

        if (!isset($this->htmlOptions['enctype'])) {
            $this->htmlOptions['enctype'] = 'multipart/form-data';
        }
        parent::init();
    }