Returns infos on the uploaded file

@return array( 'mime' => array(), 'file' => eZHTTPFile )
@throw RuntimeException if the uploaded file can not be found
164620
public function getFileInfo()
    {
        $upload = new eZContentUpload();
        $errors = array();
        $mimeData = $file = '';
        $result = $upload->fetchHTTPFile( 'UploadFile', $errors, $file, $mimeData );

        if ( $result === false )
        {
            throw new RuntimeException(
                ezpI18n::tr(
                    'extension/ezjscore/ajaxuploader',
                    'Unable to retrieve the uploaded file: %message',
                    null, array( '%message' => $errors[0]['description'] )
                )
            );
        }
        return array(
            'file' => $file,
            'mime' => $mimeData
        );
    }
1365341
protected function getData()
    {
        $assetsPath = $this->getAssetsPath();

        if (!file_exists($assetsPath) || !is_dir($assetsPath)) {
            if (!File::makeDirectory($assetsPath)) {
                throw new ApplicationException(Lang::get(
                    'cms::lang.cms_object.error_creating_directory',
                    ['name' => $assetsPath]
                ));
            }
        }

        $searchTerm = Str::lower($this->getSearchTerm());

        if (!strlen($searchTerm)) {
            $currentPath = $this->getCurrentPath();
            return $this->getDirectoryContents(
                new DirectoryIterator($currentPath)
            );
        }

        return $this->findFiles();
    }
141251
public function getContents()
    {
        if (!$this->isReadable()) {
            throw new \RuntimeException("Stream isn't readable");
        }
        
        $contents = '';
        
        while (!$this->eof()) {
            $contents .= $this->read(512000);
        }
        
        return $contents;
    }
1274
protected function getListFile()
    {
        $id = $this->getParam(0);

        if (!isset($id)) {
            return $this->file->getList(array('limit' => $this->getLimit()));
        }

        if ($this->getParam('type')) {
            return $this->file->getList(array('file_type' => $id, 'limit' => $this->getLimit()));
        }

        if ($this->getParam('mime')) {
            return $this->file->getList(array('mime_type' => $id, 'limit' => $this->getLimit()));
        }

        if ($this->getParam('entity')) {
            return $this->file->getList(array('entity' => $id, 'limit' => $this->getLimit()));
        }

        if (!is_numeric($id)) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        $result = $this->file->get($id);

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        return array($result);
    }
1272069
private static function retrieveFilesWithContents(Iterator $files): array
    {
        return array_reduce(
            iterator_to_array($files),
            static function (array $files, SplFileInfo $fileInfo): array {
                $file = $fileInfo->getRealPath();

                if (false === $file) {
                    throw new RuntimeException(
                        sprintf(
                            'Could not find the file "%s".',
                            (string) $fileInfo
                        )
                    );
                }

                if (false === is_readable($file)) {
                    throw new RuntimeException(
                        sprintf(
                            'Could not read the file "%s".',
                            $file
                        )
                    );
                }

                $files[$fileInfo->getRealPath()] = [$fileInfo->getRealPath(), file_get_contents($file)];

                return $files;
            },
            []
        );
    }
298601
public function getFileArray()
    {
        if (!$this->FileArray) {
            $user = $this->getConfig('user');
            is_true_or_fail(is_positive($user), __d('me_cms', 'You have to set a valid user id'), InvalidArgumentException::class);
            $this->FileArray = new FileArray(LOGIN_RECORDS . 'user_' . $user . '.log');
        }

        return $this->FileArray;
    }
94673
public function getContents() : string
    {
        $r = false;
        $err = ($this->stream === null || $this->readable === false);

        if ($err === false) {
            $r = stream_get_contents($this->stream);
        }

        if ($err === true || $r === false) {
            // @codeCoverageIgnoreStart
            throw new \RuntimeException("Could not get contents of stream.");
            // @codeCoverageIgnoreEnd
        }

        return $r;
    }
342867
public function readLog(): array
    {
        $logFilePath = $this->getLogFilePath();

        if (!file_exists($logFilePath)) {
            return [];
        }

        $data = @unserialize(file_get_contents($logFilePath));

        if (false === $data) {
            throw new \RuntimeException('Could not unserialize log file '.$logFilePath);
        }

        return (array) $data;
    }
634062
public function load()
    {
        // Check for existence only once and save the result
        $exists = is_file($this->file);

        if ($this->autoCreate == false && !$exists) {
            throw new RuntimeException('File does not exist');
        } else if ($this->autoCreate == true && !$exists) {
            // Create new empty file
            touch($this->file);

            $this->loaded = true;
            // There's no need to fetch content from the empty file
            return array();
        }

        $content = file_get_contents($this->file);
        $content = $this->serializer->unserialize($content);

        if (!$content) {
            $content = array();
        }

        $this->content = $content;
        $this->loaded = true;
    }
771257
protected function _getTypes() {
		$handle = new File(FILE_CACHE . 'mime_types.txt', true, 0770);
		if (!$handle->exists()) {
			# create and fill: ext||type||name||img (array serialized? separated by ||?)
			$MimeTypes = TableRegistry::get('Data.MimeTypes');
			$mimeTypes = $MimeTypes->find('all', ['fields' => ['name', 'ext', 'type', 'MimeTypeImages.name', 'MimeTypeImages.ext'], 'conditions' => ['MimeTypes.active' => 1], 'contain' => ['MimeTypeImages']]);

			$content = [];
			foreach ($mimeTypes as $m) {
				$img = (!empty($m->mime_type_image['ext']) ? $m->mime_type_image['name'] . '.' . $m->mime_type_image['ext'] : '');
				$content[] = [
					'ext' => $m['ext'],
					'name' => $m['name'],
					'type' => $m['type'],
					'img' => $img,
				];
			}
			# add special types? (file not found icon, default fallback icon, generic file ext icon...)

			if (!$handle->write(serialize($content), 'w', true)) {
				throw new Exception('Write error');
			}
		} else {
			$content = $handle->read();
			if ($content === false) {
				return [];
			}
			$content = unserialize($content);
			if ($content === false || !is_array($content)) {
				return [];
			}
		}
		return $content;
	}
338876
public function getMimeType()
    {
        if (function_exists('finfo_open')) {
            $finfo = finfo_open(FILEINFO_MIME);
            if (!$finfo) {
                throw new \RuntimeException('Failed to open finfo');
            }

            $actualInfo = @finfo_file($finfo, $this->getPathname());
            if (false === $actualInfo) {
                throw new \RuntimeException('Failed to read file info via finfo');
            }
            $mime = strtolower($actualInfo);
            finfo_close($finfo);

            if (!preg_match(
                '/^([a-z0-9]+\/[a-z0-9\-\.]+);\s+charset=(.*)$/', $mime, $matches
            )) {
                throw new \LogicException(
                    'An error parsing the MIME type "'.$mime.'".'
                );
            }

            return $matches[1];
        } elseif (function_exists('mime_content_type')) {
            return mime_content_type($this->getPathname());
        }

        throw new \RuntimeException(
            'The finfo extension or mime_content_type function are needed to '
            .'determine the Mime Type for this file.'
        );
    }
385685
public function getFileInfo()
    {
        $prefix = str_replace(yii::getAlias(yii::getAlias('@frontend/web')), '', yii::getAlias('@ueditor'));
        return array(
            "state" => $this->stateInfo,
            "url" => $prefix . $this->fullName,
            "title" => $this->fileName,
            "original" => $this->oriName,
            "type" => $this->fileType,
            "size" => $this->fileSize
        );
    }
1186312
public function getArray()
    {
        $contents = include $this->context;

        if (gettype($contents) != 'array') {
            throw new InvalidFileException($this->context . ' does not return a valid array');
        }

        return $contents;
    }
500007
public function getFilenames()
    {
        $files = [];
        foreach ($this->classList->getClasses() as $class) {
            // Push interfaces before classes if not already loaded
            try {
                $r = new \ReflectionClass($class);
                foreach ($r->getInterfaces() as $inf) {
                    $name = $inf->getFileName();
                    if ($name && !in_array($name, $files)) {
                        $files[] = $name;
                    }
                }
                if (!in_array($r->getFileName(), $files)) {
                    $files[] = $r->getFileName();
                }
            } catch (\ReflectionException $e) {
                // We ignore all exceptions related to reflection because in
                // some cases class doesn't need to exist. We're ignoring all
                // problems with classes, interfaces and traits.
            }
        }

        return $files;
    }
1001751
public function getFilePosition()
	{
		// Gzipped file... unpack it first
		$position = 0;
		$info     = @ unpack('CCM/CFLG/VTime/CXFL/COS', substr($this->data, $position + 2));

		if (!$info)
		{
			throw new \RuntimeException('Unable to decompress data.');
		}

		$position += 10;

		if ($info['FLG'] & $this->flags['FEXTRA'])
		{
			$XLEN = unpack('vLength', substr($this->data, $position + 0, 2));
			$XLEN = $XLEN['Length'];
			$position += $XLEN + 2;
		}

		if ($info['FLG'] & $this->flags['FNAME'])
		{
			$filenamePos = strpos($this->data, "\x0", $position);
			$position    = $filenamePos + 1;
		}

		if ($info['FLG'] & $this->flags['FCOMMENT'])
		{
			$commentPos = strpos($this->data, "\x0", $position);
			$position   = $commentPos + 1;
		}

		if ($info['FLG'] & $this->flags['FHCRC'])
		{
			$hcrc = unpack('vCRC', substr($this->data, $position + 0, 2));
			$hcrc = $hcrc['CRC'];
			$position += 2;
		}

		return $position;
	}
1231888
public function getArray()
    {
        try {
            $parsed = TomlParser::ParseFile($this->context);
        } catch (ParseException $e) {
            throw new InvalidFileException($e->getMessage());
        }

        // if (! is_array($parsed)) {
        //     throw new InvalidFileException('Unable to parse invalid TOML file at ' . $this->context);
        // }

        return $parsed;
    }
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;
    }