Uploads via all defined uploaders

@param string $id Nested directory's id
@param array $files An array of file entities
@return boolean
548686
public function upload($id, array $files)
    {
        foreach ($this->uploaders as $uploader) {
            if (!$uploader->upload($id, $files)) {
                return false;
            }
        }

        return true;
    }
1279992
public function in($id, array $ids)
    {
        $allParents = $this->getHierarchy($id);

        /**
         * To increase the efficiency, we can index the results of the parent.
         */
        $allParentsIndexed = [];
        foreach ($allParents as $parent) {
            $allParentsIndexed[$parent->getId()] = $parent;
        }

        foreach ($ids as $possibleParentId) {
            if (isset($allParentsIndexed[$possibleParentId])) {
                return true;
            }
        }

        return false;
    }
1074438
public static function getUploader($id = null) {
        if (!$id) {
            $id = App::cfg('default_uploader@media', App::cfg('upload.uploader', 'file'));
        }
        $uploaders = self::uploaders();
        if (isset($uploaders[ $id ])) {
            $uploader = $uploaders[ $id ];
        } else {
            $uploader = new LocaleUploader();
        }

        return apply_filter('upload\getUploader', $uploader);
    }
757062
public function upload($destination, array $files)
    {
        foreach ($files as $file) {
            if (!($file instanceof FileEntity)) {
                // This should never occur, but it's always better not to rely on framework users
                throw new LogicException(sprintf(
                    'Each file entity must be an instance of \Krystal\Http\FileTransfer\FileInfoInterface, but received "%s"', gettype($file)
                ));
            }

            // Gotta ensure again, UPLOAD_ERR_OK means there are no errors
            if ($file->getError() == \UPLOAD_ERR_OK) {
                // Start trying to move a file
                if (!$this->move($destination, $file->getTmpName(), $file->getUniqueName())) {
                    return false;
                }
            } else {
                // Invalid file, so that cannot be uploaded. That actually should be reported before inside validator
                return false;
            }
        }

        return true;
    }
322861
public function run($files, $container_type = 'default', $container_id = null)
    {
        $file_add = new FileAdd($this->dic);
        $file_remove = new FileRemove($this->dic);

        $files_ids = [];
        $files_errors = [];

        if (!empty($files)) {
            foreach ($files as $file) {
                switch ($file['action']) {
                    case 'add':
                        $result = $file_add->run(
                            $file['file_id'],
                            $file['orig_name'],
                            $container_type,
                            $container_id
                        );

                        if (isset($result['errors'])) {
                            $files_errors[] = array_merge($file, $result);
                        } else {
                            $files_ids[] = $result['data']['id'];
                        }
                        break;

                    case 'remove':
                        $result = $file_remove->run($file['file_id']);

                        if (isset($result['errors'])) {
                            $files_ids[] = $file['file_id'];
                            $files_errors[] = array_merge($file, $result);
                        }
                        break;

                    default:
                        $files_ids[] = $file['file_id'];
                        break;
                }
            }
        }

        return [
            'ids'    => $files_ids,
            'errors' => $files_errors,
        ];
    }
552337
protected function setUploadedFiles(array $files)
    {
        $validate = function ($files) use (&$validate) {
            foreach ($files as $item) {
                if (is_array($item)) {
                    $validate($item);
                    continue;
                }
                if (! $item instanceof UploadedFileInterface) {
                    throw new InvalidArgumentException(
                        'Invalid structure of uploaded files provided.'
                    );
                }
            }
        };
        $validate($files);
        $this->uploadedFiles = $files;

        return $this;
    }
875144
public function handleMultipleFiles(array $files)
    {
        foreach ($files as $file) {
            $this->handleSingleFile($file);
        }
        return $this->getUploadedFilesList();
    }
1320982
public function connect($id, array $params)
    {
        $this->directory = isset($params['dir'])
            ? $params['dir'].($params['dir'][strlen($params['dir'])-1] === DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR)
            : FILES_PATH.'generis'.DIRECTORY_SEPARATOR.$id.DIRECTORY_SEPARATOR;
        $this->levels = isset($params['levels']) ? $params['levels'] : self::DEFAULT_LEVELS;
        $this->humanReadable = isset($params['humanReadable']) ? $params['humanReadable'] : false;

        // Sets ttl mode TRUE when the passed ttl mode is true.
        $this->setTtlMode(
            (isset($params[static::OPTION_TTL]) && $params[static::OPTION_TTL] == true)
        );

        return new common_persistence_KeyValuePersistence($params, $this);
    }
491693
public function getFileset($id) {
    $filesets = $this->getFilesets();
    if (isset($filesets[$id])) {
      return $filesets[$id];
    }
    $this->logger->warning("Fileset $id not found");

    return NULL;
  }
309597
public function has($id)
    {
        foreach ($this->containers as $container) {
            if ($container->has($id)) {
                return true;
            }
        }

        return false;
    }
1261643
public function upload($id, array $files)
    {
        $destination = $this->getDestination($id);

        if ($this->maxWidth != 0 && $this->maxHeight != 0) {
            foreach ($files as $file) {

                $imageProcessor = new ImageProcessor($file->getTmpName());
                $imageProcessor->thumb($this->maxWidth, $this->maxHeight);

                $to = sprintf('%s/%s', $destination, $file->getUniqueName());

                // Ensure that destination actually exists
                if (!is_dir($destination)) {
                    mkdir($destination, 0777, true);
                }

                // This might fail sometimes
                $imageProcessor->save($to, $this->quality);
            }

        } else {

            // Otherwise, treat image as a regular file
            $uploader = new FileUploader();

            // And just upload it
            return $uploader->upload($destination, $files);
        }

        return true;
    }
795436
function(id){
        var i = qq.indexOf(this._queue, id);
        this._queue.splice(i, 1);
                
        var max = this._options.maxConnections;
        
        if (this._queue.length >= max && i < max){
            var nextId = this._queue[max-1];
            this._upload(nextId, this._params[nextId]);
        }
    }
149995
function(id) {
			var i;
			for (i = files.length - 1; i >= 0; i--) {
				if (files[i].id === id) {
					return files[i];
				}
			}
		}
301705
protected function checkFileUploadWithSessionGuard($id)
    {
        $guard = $this->getFileUploadSesssionGuard();

        return ! $guard->enabled() || $guard->check($id);
    }
269666
public function update($id, UpdateUploadRequest $request)
    {
        $upload = $this->repository->find($id);

        if (empty($upload)) {
            return $this->sendError('Upload not found');
        }
        $all = $request->all();

        $upload = $this->repository->update($all, $id);
        $upload->load($request->getWith());

        return $this->sendResponse($upload, 'Upload updated successfully.');
    }
218840
public function actionDownloadFile($id): void
	{
		$this->sendResponse($this->app->logs->downloadFile($id));
	}
548874
public function createForFolder(string $id, array $params = [])
    {
        return $this->executeRequest(
            RequestMethodEnum::POST,
            ResourceMethodEnum::CREATE_FOR_FOLDER,
            $params,
            $id
        );
    }