Files

@param string $filename = NULL
@param string $type     = 'name'

@return mixed
178438
public static function files(String $fileName = NULL, String $type = 'name')
    {
        return $_FILES[$fileName][$type] ?? false;
    }
823734
public function getFiles($type)
	{
		$f = $type . 'Files';

		if (property_exists($this, $f))
		{
			return self::${$f};
		}

		$this->say('Missing Files: ' . $type);

		return "";
	}
1066425
public function files($dirname = '.')
    {
        $listing = $this->listDirectoryContents($dirname);

        return array_values(array_filter($listing, function ($item) {
            return $item['type'] === 'file';
        }));
    }
379913
public function getFileType(): ?array
    {
        if (empty($this->byteCache)) {
            return null;
        }

        /** cache */
        if (is_null($this->fileType)) {
            $this->fileType = $this->checkFileType();
        }

        return $this->fileType;
    }
648034
public function unlink($filename,$type=''){
        switch(strtolower($type)){
            case 'f':       
                $kv     =   $this->getKv();
                unset($this->kvs[$filename]);
                return $kv->delete($filename);
            case 'html':    
                $kv     =   $this->getKv();
                unset($this->htmls[$filename]);
                return $kv->delete($filename);
            default:
                unset($this->contents[$filename]);
                return $this->mc->delete($filename);            
        }        
    }
1024778
static public function tryCreateFromFile($filename) {
		try {
			$instance = self::createFromFile($filename);
			return $instance;
		} catch (\Exception $exception) {
			return null;
		}
	}
1217137
public function getFiles(string $name = null) : array
    {
        if ($name === null) {
            return $this->files;
        }

        $files = $this->resolvePath($this->files, $name);

        if ($files instanceof UploadedFile) {
            return [$files];
        }

        if (is_array($files)) {
            return array_filter($files, static function ($file) {
                return $file instanceof UploadedFile;
            });
        }

        return [];
    }
835678
protected static function _getFiles(&$config, $type, $silent = false) {
		$typeNS = $config ["mvcNS"] [$type];
		$typeDir = \ROOT . \DS . str_replace ( "\\", \DS, $typeNS );
		if (! $silent)
			echo \ucfirst ( $type ) . " directory is " . \ROOT . $typeNS . "\n";
		return UFileSystem::glob_recursive ( $typeDir . \DS . '*' );
	}
832943
public function unlink($filename,$type=''){
        unset($this->contents[$filename]);
        return is_file($filename) ? unlink($filename) : false; 
    }
971968
public function append($filename,$content,$type=''){
        if($old_content = $this->read($filename,$type)){
            $content =  $old_content.$content;
        }
        return $this->put($filename,$content,$type);
    }
221561
public static function get_files_to_publish($type = null)
    {
        if (!isset(static::$publishes[ static::class ])) {
            return [];
        }

        if ($type !== null) {
            return static::$publishes[ static::class ][ $type ];
        }

        $iterator = new RecursiveIteratorIterator(
            new RecursiveArrayIterator(static::$publishes[ static::class ])
        );

        return \iterator_to_array($iterator);
    }
1346109
public function getFile($fileName)
    {
        $result = false;

        if (isset($_FILES[$fileName])) {
            $result = $_FILES[$fileName];
        }

        return $result;
    }
96520
public function getImages($type = null)
    {
        if ($type) {
            if (! isset($this->imagesOfType[$type])) {
                if (count($this->images)) {
                    $this->imagesOfType[$type] = $this->images->where('image_type', $type);
                } else {
                    $this->imagesOfType[$type] = collect([]);
                }
            }

            return $this->imagesOfType[$type];
        }

        return $this->images;
    }
1129949
public function file( $name = '' )
	{
		if( is_array( $name ) ){
			return $this->file = array_merge( $this->file, $name );
		}
		$files = $this->file;
		if( !empty( $files ) ){
			if( $name == '' ){
				return $files;
			} else{
				return $files[$name];
			}
		}
		return null;
	}
1246934
public static function getFileFromManifest(array $config, string $fileName, string $type = 'legacy'): string
    {
        try {
            $path = self::getModuleEntry($config, $fileName, $type, true);
        } catch (NotFoundHttpException $e) {
            Craft::error($e->getMessage(), __METHOD__);
        }
        if ($path !== null) {
            $path = self::combinePaths(
                $config['localFiles']['basePath'],
                $path
            );

            return self::getFileFromUri($path, null) ?? '';
        }

        return '';
    }
1292612
protected function getDefinitionFile($type, $name)
    {
        if (array_key_exists($name, $this->definitionFiles)) {
            return $this->definitionFiles[$name];
        }

        $this->definitionFiles[$name] = null;
        $this->definitionFiles[$name] = $this->findDefinitionFileByComposer($name);

        if (null !== $this->definitionFiles[$name]) {
            return $this->definitionFiles[$name];
        }

        $this->definitionFiles[$name] = $this->findDefinitionFileByName($name);

        if (null !== $this->definitionFiles[$name]) {
            return $this->definitionFiles[$name];
        }

        $this->definitionFiles[$name] = $this->findDefinitionFileByRegex($type, $name);

        return $this->definitionFiles[$name];
    }
355939
public function fetchData($filename, $type) {
        $absPath    = $this->_getAbsPath($filename, $type);
        $sftpStream = $this->getSftpStream($absPath, 'rb');

        $content    = $this->_fetchAndCloseStream($sftpStream);

        if ($content !== false) {
            return $content;
        } else throw new Exception("Could not read {$absPath} on " . $this->getEnvironment());
    }