Skip to content

Throws UnableToCreateDirectory when only reading a file #1849

@mvoermans

Description

@mvoermans

Question

@frankdejonge

Hello, I'm using the ReadOnlyFilesystemAdapter to read a file. When open a file I get an 'UnableToCreateDirectory' exception.

The file I want to read is test.pdf. It's located in the //test/folder1 directory.

The function i use to get the file data:

public static function getFile($path, $fileName)
{
    try {

        $adapter = new LocalFilesystemAdapter($path);
        $fileSystem = new ReadOnlyFilesystemAdapter($adapter);

        return $fileSystem->read($fileName);
    } catch (FilesystemException | UnableToReadFile | UnableToCreateDirectory $exception) {
        return $exception;
    }
}

$file = getFile('//test/folder1/', 'test.pdf ')

It's installed on a Windows server and there is only a read authorization.

Q A
Flysystem Version 3.29.1
Adapter Name Read-only Adapter
Adapter version 3.28.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions