upload file or files

@param array $options
@return array|boolean
1802
protected function uploadFile($options)
    {
        if ( $options['type'] === 'file' ) {
            $this->repo = new FileRepository($options);
            $this->hasFile = true;
        } else {
            $this->repo = new ImageRepository($options);
            $this->hasPhoto = true;
        }

        if ( ! $this->repo->upload($this->model, $this->request) ) {
            return false;
        }

        return $this->repo->getDatas($this->request);
    }
693747
public function submit($options = [])
    {
        if (is_string($options)) {
            $options = ['value' => $options];
        }

        if (!Arr::has($options, 'type')) {
            Arr::set($options, 'type', 'submit');
        }

        $input = new Input($this->expression('input'), $options);

        return $input;
    }
245788
public function save(array $options = [])
    {
        $this->validation = Arr::get($options, 'validation', $this->validation);

        if ($this->validation) {

            $attributes = $this->getAttributes();

            $validation = $this->validation($attributes);

            if ($validation instanceof MbValidation) {
                $validation->check(true);
                $attributes = $validation->getData();
            } elseif (is_array($validation)) {
                $attributes = $validation;
            }

            $this->fill($attributes);
        }

        return parent::save($options);
    }
40069
public function saveIfExists(array $options = []): bool
    {
        if ($this->exists === false) {
            return false;
        }

        return $this->save($options);
    }
34782
public function download(array $options)
    {
        $requestUrl = null;
        $requestOptions = [
            'headers' => [
                'Authorization' => $this->authToken,
            ],
            'sink' => isset($options['SaveAs']) ? $options['SaveAs'] : null,
        ];

        if (isset($options['FileId'])) {
            $requestOptions['query'] = ['fileId' => $options['FileId']];
            $requestUrl = $this->downloadUrl.'/b2api/v1/b2_download_file_by_id';
        } else {
            if (!isset($options['BucketName']) && isset($options['BucketId'])) {
                $options['BucketName'] = $this->getBucketNameFromId($options['BucketId']);
            }

            $requestUrl = sprintf('%s/file/%s/%s', $this->downloadUrl, $options['BucketName'], $options['FileName']);
        }

        $this->authorizeAccount();

        $response = $this->client->request('GET', $requestUrl, $requestOptions, false);

        return isset($options['SaveAs']) ? true : $response;
    }
858140
public function importFromArray(array $options)
    {
        foreach ($options as $key => $value) {
            switch (true) {
                case $key === 'args':
                    $this->args = $value;
                    break;
                case is_integer($key):
                    $this->args[] = $value;
                    break;
                default:
                    $this->options[$key] = $value;
                    break;
            }
        }
    }
1222445
public static function uploadFiles(\Object $data, array $options = array()) {
        $return = array('success' => array(), 'errors' => array());
        foreach ($data->toArray(TRUE) as $ppt => $info) {
            if (is_array($options['ignore']) && in_array($ppt, $options['ignore']))
                continue;
            self::makeValuesArray($info);

            foreach ($info['name'] as $key => $name) {
                if ($info['error'][$key] !== UPLOAD_ERR_OK) {
                    $return['errors'][$ppt][$name] = self::UPLOAD_ERROR_NO_FILE;
                    continue;
                }

                if (isset($options['maxSize'][$key]) && $info['size'] > $options['maxSize'][$key]) {
                    $return['errors'][$ppt][$name] = self::UPLOAD_ERROR_SIZE;
                    continue;
                }

                $tmpName = $info['tmp_name'][$key];
                $pInfo = pathinfo($name);
                if (isset($options['extensions']) && !in_array(strtolower($pInfo['extension']), $options['extensions'])) {
                    $return['errors'][$ppt][$name] = self::UPLOAD_ERROR_EXTENSION;
                    continue;
                }
                $dir = isset($options['path']) ? $options['path'] : DATA . 'uploads';
                if (substr($dir, strlen($dir) - 1) !== DIRECTORY_SEPARATOR)
                    $dir .= DIRECTORY_SEPARATOR;
                if (!is_dir($dir)) {
                    if (!mkdir($dir, 0777, true)) {
                        $return['errors'][$ppt][$name] = self::UPLOAD_ERROR_PATH;
                        continue;
                    }
                }
                $savePath = $dir . $options['prefix'] . preg_replace('/[^A-Z0-9._-]/i', '_', basename($pInfo['filename'])) . '.' . $pInfo['extension'];
                if (move_uploaded_file($tmpName, $savePath)) {
                    $return['success'][$ppt][$name] = $savePath;
                    self::$uploadSuccess = $savePath;
                } else {
                    $return['errors'][$ppt][$name] = self::UPLOAD_ERROR_FAILED;
                }
            }
        }
        return $return;
    }
316510
private function validateOptions(array $options)
    {
        $oneupUploaderMapping = $options['oneup_uploader_mapping'];

        if (!isset($this->oneupUploaderConfig['mappings'][$oneupUploaderMapping])) {
            $message = sprintf(
                '1-up uploader mapping "%s" does not exist, existing mappings: "%s".',
                $oneupUploaderMapping,
                implode('", "', array_keys($this->oneupUploaderConfig['mappings']))
            );

            throw new FormException($message);
        }

        $uploadableClass = $options['uploadable_class'];

        if (!class_exists($uploadableClass)) {
            throw new FormException(sprintf('Uploadable class "%s" does not exist.', $uploadableClass));
        }
        if (!$this->vichUploaderMetadataReader->isUploadable($uploadableClass)) {
            throw new FormException(sprintf('Class "%s" is not valid uploadable class.', $uploadableClass));
        }
    }
829869
public function saveIfExistsOrFail(array $options = []): bool
    {
        if ($this->exists === false) {
            return false;
        }

        return $this->saveOrFail($options);
    }
894169
public function save(array $options = [])
    {
        $data = $this->serialize();

        $this->security->getKuzzle()->query(
            $this->security->buildQueryArgs($this->saveActionName),
            $data,
            $options
        );

        return $this;
    }
612577
public function putFile($path, $file, $options = [])
    {
        return $this->putFileAs($path, $file, $file->hashName(), $options);
    }
112489
public static function submit($value, array $options = [])
    {
        self::exclure($options, ['type', 'value']);

        return self::input('submit', 'null', $value, $options);
    }
1308527
public function file($fieldName, array $options = [])
    {
        $errorSuffix = null;
        $error       = $this->error($fieldName);
        $content     = parent::file($fieldName, $options);

        if ($this->getConfig('materializeCss', false) === false) {
            return $content;
        }

        $options = $this->_parseOptions($fieldName, $options);

        $options['type'] = __FUNCTION__;
        if ($error !== '') {
            $options['error'] = $error;
            $errorSuffix = 'Error';
        }

        $result = $this->_inputContainerTemplate([
            'error'       => $error,
            'content'     => $content,
            'options'     => $options,
            'errorSuffix' => $errorSuffix
        ]);

        return $result;
    }
903227
protected function loadFile(string $file, array $options): ?Config
    {
        if (is_dir($file)) {
            return (bool)($options['recursive'] ?? false) ? $this->load($file, $options) : null;
        }

        return $this->getFileLoader()->load($file, $options);
    }
399502
public function checkFiles($options = "-m") {

        try {
            $output = $this->cmd(sprintf('status %s', $options));
            if (strlen($output['output']) == 0) {
                $output['output'] = "No files modified.";
                $output['modified'] = false;
            } else {
                $output['modified'] = true;
            }
            return $output;
        } catch (Exception $ex) {
            return $ex;
        }
    }
214698
public function upload($files = [])
    {
        foreach ($files as $file) {
            $this->storage->putFileAs($this->path, $file, $file->getClientOriginalName());
        }

        return true;
    }
1306531
public function save(array $options = array())
    {

        try {
            DB::transaction(function() use($options) {
                $this->fill($options);
                parent::save();
            });

            return true;
        } catch (Exception $e) {
            Log::emergency($e);
            return false;
        }
    }