Handle the uploaded file(s)

@param array $files
@return bool
183430
public function handleUploadFiles($files)
    {
        $dir = $this->getFileManager()->getDir();

        /** @var FileManagerDriver $driver */
        $driver = $this->container->get('youwe.file_manager.driver');

        $this->getFileManager()->event(YouweFileManagerEvents::BEFORE_FILE_UPLOADED);
        
        /** @var UploadedFile $file */
        foreach ($files as $file) {
            $extension = $file->guessExtension();
            if (!$extension) {
                $extension = 'bin';
            }

            if (in_array($file->getClientMimeType(), $this->getFileManager()->getExtensionsAllowed())) {
                $driver->handleUploadedFiles($file, $extension, $dir);
            } else {
                $this->getFileManager()->throwError("Mimetype is not allowed", 500);
            }
        }

        $this->getFileManager()->event(YouweFileManagerEvents::AFTER_FILE_UPLOADED);
    }
299190
public static function validateUploadedFiles(array $files)
    {
        foreach ($files as $file) {
            if (is_array($file)) {
                static::validateUploadedFiles($file);

                continue;
            }

            if (!$file instanceof UploadedFileInterface) {
                return false;
            }
        }

        return true;
    }
1222166
public function execute($files)
  {
    printLn('=> PageWriter.');
    $pages = Application::db()->retrieve('page_list');

    $writer = new DataWriter();

    foreach($pages as $page) {
      $tmpl = $this->make_data($page);
      $writer->write($tmpl['slug'], 'index.html', $tmpl['html']);
    }
  }
1041069
public function createUploadedFilesFromArray(array $files)
    {
        $uploadedFiles = [];

        if (isset($files['tmp_name']) && ! is_array($files['tmp_name'])) {
            $uploadedFiles[] = $this->createUploadedFile(
                $files['tmp_name'],
                $files['size'],
                $files['error'],
                $files['name'],
                $files['type']
            );
        } elseif (isset($files['tmp_name']) && is_array($files['tmp_name'])) {
            foreach ($files['tmp_name'] as $key => $file) {
                $uploadedFiles[] = $this->createUploadedFile(
                    $file,
                    $files['size'][$key],
                    $files['error'][$key],
                    $files['name'][$key],
                    $files['type'][$key]
                );
            }
        } else {
            foreach ($files as $key => $value) {
                $uploadedFiles[$key] = $this->createUploadedFilesFromArray($value);
            }
        }

        return $uploadedFiles;
    }
1353391
public function addFiles(array $files)
    {
        $added_files = 0;
        foreach ($files as $localName => $fileName) {
            if (is_null($fileName)) {
                if ($this->zip->addEmptyDir($localName) === false)
                    throw new Exception($this->zip->getStatusString(), $this->zip->status);
            } else {
                if ($this->zip->addFile($fileName, $localName) === false)
                    throw new Exception($this->zip->getStatusString(), $this->zip->status);
                $added_files++;
            }
        }

        // reopen archive to save changes
        $archive_filename = $this->zip->filename;
        $this->zip->close();
        $this->open($archive_filename);

        return $added_files;
    }
1023645
private function validateUploadedFiles(array $uploadedFiles)
    {
        foreach ($uploadedFiles as $file) {
            if (is_array($file)) {
                $this->validateUploadedFiles($file);
            } elseif (!$file instanceof UploadedFileInterface) {
                throw new InvalidArgumentException('Invalid entry in uploaded files structure');
            }
        }
    }
7079
public function delete(array $files)
    {
        $filesystem = $this->getFilesystem($this->field, $this->settings);
        $results = [];
        foreach ($files as $path) {
            $results[] = $this->deletePath($filesystem, $path);
        }

        return $results;
    }
1295210
public function setFiles(array $files)
    {
        $this->files = array();
        foreach ($files as $key => $file) {
            if (!is_array($file)) {
                $file = array('content' => $file);
            }

            $file = array_merge(array(
                'content' => null,
                'mtime' => null,
            ), $file);

            $this->setFile($key, $file['content'], $file['mtime']);
        }
    }
390510
public function handle($path)
    {
        try {
            $this->filesystem->url($path);
        } catch (\Exception $e) {
            return false;
        }

        return true;
    }
549959
public function flush(array $items = [])
    {
        if (! $this->callFunc($items)) {
            $this->handleFailure($this->id, $items);
            return false;
        }
        return true;
    }
1220903
private function checkFiles(array $files) : void
    {
        foreach ($files as $value) {
            if (is_array($value)) {
                $this->checkFiles($value);
            } elseif (! $value instanceof UploadedFile) {
                $type = is_object($value) ? get_class($value) : gettype($value);

                throw new \InvalidArgumentException('Expected ' . UploadedFile::class . ' or array, got ' . $type);
            }
        }
    }
686526
protected function convertUploadedFiles( array $files )
	{
		return array_map( function ( $file )
		{
			if ( is_null( $file ) || ( is_array( $file ) && empty( array_filter( $file ) ) ) )
				return $file;

			return is_array( $file ) ? $this->convertUploadedFiles( $file ) : UploadedFile::createFromBase( $file );
		}, $files );
	}
123229
public function findRequiredFiles(array $files)
    {
        foreach ($files as $file) {
            if (file_exists($this->plugin->directory.'/'.$file)) {
                $this->addSuccess(sprintf('Found required file: %s', $file));
            } else {
                $this->addError(sprintf('Failed to find required file: %s', $file));
            }
        }
    }
641873
public function setMerged(array $files)
    {
        if (!empty($files)) {
            foreach ($files as $_file) {
                if (is_array($_file) && isset($_file['file'])) {
                    if (isset($_file['media'])) {
                        $this->add($_file['file'], $_file['media']);
                    } else {
                        $this->add($_file['file']);
                    }
                } elseif (is_string($_file)) {
                    $this->add($_file);
                }
            }
        }
        return $this;
    }
1125686
public function setFiles($files)
    {
        $this->_files = array();
        $token        = ' ,;';
        $file         = strtok($files, $token);

        while ($file !== false) {
            $this->_files[] = $file;
            $file           = strtok($token);
        }

    }
619884
public function setFiles($files) {
		$files = $this->parseFiles($files);
		$this->file->setAll($files);
	}
550103
protected static function parseFiles(array $files)
    {
        $normalizedFiles = array();

        foreach($files as $name => $file)
        {
            if(is_array($file) && !isset($file['tmp_name']))
                $normalizedFiles[$name] = static::parseFiles($file);
            else if(isset($file['tmp_name']) && is_array($file['tmp_name']))
                $normalizedFiles[$name] = static::normalizeFilesTree($file);
            else if(isset($file['tmp_name']))
                $normalizedFiles[$name] = new static(
                    $file['name'], $file['type'], $file['tmp_name'], $file['error'], $file['size']
                    );
        }

        return $normalizedFiles;
    }