Get uploaded files

@access public
@return array
325322
public function file() {
		static $res = null;
		if ($res === null) {
			$res = [];
			foreach ($this->files as $v) {
				$res[] = new File($v);
			}
		}
		return $res;
	}
612983
public function getInput()
    {
        $data = $this->getRequest()->getParsedBody();
        
        if (is_array($data)) {
            $files = $this->getRequest()->getUploadedFiles();
            $data = array_replace_recursive($data, (array)$files);
        }
        
        return $data;
    }
569282
public function getFiles()
    {
        $files = $this->files;

        foreach ($this->types as $type) {
            $files = array_merge($files, $type->getFiles());
        }
        
        $path = \Altamira\Config::getInstance()->getPluginPath( $this->getLibrary() );
        
        array_walk( $files, function( &$val ) use ( $path ) { $val = $path . $val; } ); 

        return $files;
    }
51734
public function find()
    {
        $files = [];

        foreach ($this->getDirectoryIterator() as $file) {
            if ($this->getExtension($file) !== 'php') continue;

            $files[] = $file->getPathname();
        }

        return $files;
    }
1062761
public function getFiles()
    {
        if (!in_array($this->getMethod(), array('POST', 'PUT', 'DELETE', 'PATCH'))) {
            return array();
        }

        $files = array();

        foreach ($this->fields->all() as $name => $field) {
            if ($field->isDisabled()) {
                continue;
            }

            if ($field instanceof Field\FileFormField) {
                $files[$name] = $field->getValue();
            }
        }

        return $files;
    }
1090249
protected function defaultUploadedFiles()
    {
        $files = [];
        foreach ($_FILES as $class => $info) {
            $files[$class] = [];
            $this->populateUploadedFileRecursive($files[$class], $info['name'], $info['tmp_name'], $info['type'], $info['size'], $info['error']);
        }

        return $files;
    }
752566
public function index()
    {
        if (request()->ajax()) {
            return response()->json([
                'status' => true,
                'files' => $this->model
                    ->when('owner' != user('role'), function ($query) {
                        // Show files only to current user.
                        $query->where('user_id', user('id'));
                    })
                    ->filter(request([
                        'attachment_id',
                        'attachment_type',
                    ]))
                    ->get(),
            ], 200);
        }

        return $this->makeResponse('index', [
            'filetype' => html_secure(request('filetype', null)),
            'files' => $this->model
                ->with([
                    'attachment'
                ])
                ->when('owner' != user('role'), function ($query) {
                    // Show files only to current user.
                    $query->where('user_id', user('id'));
                })
                // Show files only to articles.
                // ->where('attachment_type', (new Article)->getMorphClass())
                ->filter(request(['filetype', 'user']))
                ->latest()
                ->paginate(18)
                ->appends(
                    request()->except(['page'])
                )
        ]);
    }
1327460
private function getFiles(): array
	{
		$result = [];
		$files = Finder::find('*')
			->in($this->getFullPath());
		foreach ($files as $file) {
			$result[] = new FileInfo($file);
		}
		usort($result, function ($a, $b) {
			if ($a->isDir == $b->isDir) {
				return strcmp($a->name, $b->name);
			} else {
				if ($a->isDir) {
					return -1;
				} else {
					return 1;
				}
			}
		});
		return $result;
	}
711698
public function upload()
    {
        $uploaded_files = request()->file('upload');
        $error_bag = [];
        $new_filename = null;

        foreach (is_array($uploaded_files) ? $uploaded_files : [$uploaded_files] as $file) {
            try {
                $new_filename = $this->lfm->upload($file);
            } catch (\Exception $e) {
                Log::error($e->getMessage(), [
                    'file' => $e->getFile(),
                    'line' => $e->getLine(),
                    'trace' => $e->getTraceAsString()
                ]);
                array_push($error_bag, $e->getMessage());
            }
        }

        if (is_array($uploaded_files)) {
            $response = count($error_bag) > 0 ? $error_bag : parent::$success_response;
        } else { // upload via ckeditor 'Upload' tab
            if (is_null($new_filename)) {
                $response = $error_bag[0];
            } else {
                $response = view(Lfm::PACKAGE_NAME . '::use')
                    ->withFile($this->lfm->setName($new_filename)->url());
            }
        }

        return $response;
    }
255078
protected function getDeltasFilesArray()
    {
        $files = [];

        $baseDir = realpath($this->dir);
        $dh = opendir($baseDir);

        if ($dh === false) {
            return $files;
        }

        $fileChangeNumberPrefix = '';
        while (($file = readdir($dh)) !== false) {
            if (preg_match('[\d+]', $file, $fileChangeNumberPrefix)) {
                $files[(int) $fileChangeNumberPrefix[0]] = $file;
            }
        }

        return $files;
    }
513590
public function getDataAsArray()
    {
        $fields = $this->getFields();

        if (!$fields) {
            return [];
        }

        $result = [];

        foreach ($fields as $field) {
            //ignore non-fields
            if (!$field instanceof AbstractFormField) {
                continue;
            }

            // if a field is disabled, we will ignore the field and only set an empty string as value
            if ($field->isDisabled()) {
                if (!array_key_exists($field->getName(), $result)) {
                    $result[$field->getName()] = '';
                }
                continue;
            }


            if ($field instanceof CheckBox) {
                $result[$field->getName()] = $field->isChecked() ? $field->getValue() : '';
            } elseif ($field instanceof RadioButton) {
                // if the field is not checked...
                if (!$field->isChecked()) {
                    // there was no other field with the same name yet
                    if (!array_key_exists($field->getName(), $result)) {
                        // then set the field with an empty value
                        $result[$field->getName()] = '';
                    }
                } // the field is checked
                else {
                    $result[$field->getName()] = $field->getValue();
                }
            } elseif ($field instanceof UploadField) {
                $value = $field->getValue();
                if (!$value ||
                    !isset($value['error']) ||
                    $value['error'] == UPLOAD_ERR_NO_FILE ||
                    empty($value['name'])
                ) {
                    continue;
                }
                $result[$field->getName()] = $value['name'];
            } elseif ($field instanceof AbstractFormField) {
                $result[$field->getName()] = $field->getValue();
            }
        }
        return $result;
    }
1063661
private function getFiles(array $uploadedFiles)
    {
        $files = [];

        foreach ($uploadedFiles as $key => $value) {
            if ($value instanceof UploadedFileInterface) {
                $files[$key] = $this->createUploadedFile($value);
            } else {
                $files[$key] = $this->getFiles($value);
            }
        }

        return $files;
    }
803473
public function get_files() {
        $fs = get_file_storage();
        $files = $fs->get_area_files($this->get_context()->id, 'core_competency', 'userevidence', $this->get('id'),
            'filename', false);
        return $files;
    }
64603
protected function getFiles()
    {
        if ($this->isSiteDeployment) {
            if ($this->deviceView != 'main' && !is_dir("{$this->viewDirectory}/{$this->context}/{$this->siteDomain}/{$this->deviceView}")) {
                $this->deviceView = 'main';
            }

            if ($this->design != 'default' && !is_dir("{$this->viewDirectory}/{$this->context}/{$this->siteDomain}/{$this->deviceView}/{$this->design}")) {
                $this->design = 'default';
            }
        }

        $list = array();
        if (!empty($this->viewDirectory))
            $list[] = $this->viewDirectory;

        // Build the list from all the plugin directorys, and the theme directory
        $list = array_merge($this->ApplicationContext->getEnabledPluginDirectories(),$list);

        if (count($list) > 0) {
            $files = array();
            foreach ($list as $tp) {
                if (is_dir($tp)) {
                    $paths = $this->getPathsToCheck($tp, $this->subject);
                    foreach ($paths as $basepath) {
                        if(!is_dir($basepath))
                            continue;

                        $cutoffDepth = null;
                        $objects     = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($basepath),
                                                                     RecursiveIteratorIterator::SELF_FIRST);

                        foreach ($objects as $name => $object) {
                            if($cutoffDepth !== null && $objects->getDepth() > $cutoffDepth)
                                continue;
                            else
                                $cutoffDepth = null;

                            if ($cutoffDepth === null && $object->isDir() && substr($object->getBasename(), 0, 1) == '.') {
                                $cutoffDepth = $objects->getDepth();
                                continue;
                            }

                            if (!$object->isFile() || substr($object->getBasename(), 0, 1) == '.')
                                continue;

                            $files[substr($name, strlen($basepath))] = $name;
                        }
                    }

                } else {
                    $this->Logger->warn('Directory does not exist: '.$tp);
                }
            }

            if(empty($files))
                return array(array(),null);

            $timestamps = array();
            foreach ($files as $relpath => $filename) {
                $timestamps[] = filemtime($filename);
            }

            $md5 = md5(serialize(array($files,$timestamps/*, $this->VersionService->getSystemVersion(), $this->VersionService->getDeploymentRevision()*/)));

            return array($files, $md5);
        }

        throw new Exception('No active themes or plugins.');
    }
709451
private function getMigrationsFiles()
    {
        $migrationPath = $this->migrateManager->storagePath;
        $files = array();
        if ($handle = opendir($migrationPath)) {

            while (false !== ($entry = readdir($handle))) {

                if ($entry != "." && $entry != ".." && is_file($migrationPath . '/' . $entry)) {
                    $segments = explode('_', $entry);
                    $files[$segments[0]] = $entry;
                }
            }

            closedir($handle);

            return $files;
        }

        die (Utils::colorize("Error to open migrations storage", "FAILURE"));
    }
139245
public function data()
    {
        $workingWith = $this->isGet() ? $this->_GET : $this->_POST;
        $data = (array)Hash::get($workingWith, "data");

        // The previous line will have ignored uploaded files.
        // Added them to the array if we find something.
        if ($this->hasFiles()) {
            return $this->addFilesList($data);
        }

        return $data;
    }
1188230
public function getFiles()
    {
        if(!$this->isPropertyAvailable('Files')){
            $this->setProperty("Files", new FileCollection($this->getContext(),new ResourcePathEntity($this->getContext(),$this->getResourcePath(), "Files")));
        }
        return $this->getProperty("Files");
    }