- Qt 6.8
- Qt WebEngine
- C++ Classes
- QtWebEngineCore
- QWebEngineFileSystemAccessRequest
- Qt 6.8.0 Reference Documentation

# QWebEngineFileSystemAccessRequest Class

The QWebEngineFileSystemAccessRequest class enables accepting or rejecting requests for local file system access from JavaScript applications. More...

Header: | #include <QWebEngineFileSystemAccessRequest>
CMake: | find_package(Qt6 REQUIRED COMPONENTS WebEngineCore) target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore)
qmake: | QT += webenginecore
Since: | Qt 6.4

- List of all members, including inherited members

## Public Types

enum | AccessFlag { Read, Write }
flags | AccessFlags
enum | HandleType { File, Directory }

## Properties

- accessFlags : const AccessFlags
- filePath : const QUrl
- handleType : const HandleType
- origin : const QUrl

## Public Functions

void | accept()
QWebEngineFileSystemAccessRequest::AccessFlags | accessFlags() const
QUrl | filePath() const
QWebEngineFileSystemAccessRequest::HandleType | handleType() const
QUrl | origin() const
void | reject()

## Related Non-Members

bool | operator!=(const QWebEngineFileSystemAccessRequest &lhs, const QWebEngineFileSystemAccessRequest &rhs)
bool | operator==(const QWebEngineFileSystemAccessRequest &lhs, const QWebEngineFileSystemAccessRequest &rhs)

## Detailed Description

To allow web applications to access local files of the computer, applications must connect to QWebEnginePage::fileSystemAccessRequested, which takes a QWebEngineFileSystemAccessRequest instance as an argument.

If a web applications requests access to local files or directories, QWebEnginePage::fileSystemAccessRequested will be emitted with an QWebEngineFileSystemAccessRequest instance as an argument where accessFlags() indicates the type of the requested access: read, write or both. The signal handler needs to then either call accept() or reject().

## Member Type Documentation

### enum QWebEngineFileSystemAccessRequest::AccessFlag
flags QWebEngineFileSystemAccessRequest::AccessFlags

This enum describes the type of the requested access: read, write or both. The options can be OR-ed together from the following list:

Constant | Value
--- | ---
`QWebEngineFileSystemAccessRequest::Read` | `0x1`
`QWebEngineFileSystemAccessRequest::Write` | `0x2`

The AccessFlags type is a typedef for QFlags<AccessFlag>. It stores an OR combination of AccessFlag values.

### enum QWebEngineFileSystemAccessRequest::HandleType

This enum describes the type of the requested file system entry.

Constant | Value
--- | ---
`QWebEngineFileSystemAccessRequest::File` | `0`
`QWebEngineFileSystemAccessRequest::Directory` | `1`

## Property Documentation

### `[read-only]` accessFlags : const AccessFlags

Contains the requested file access rights.

Access functions:

QWebEngineFileSystemAccessRequest::AccessFlags | accessFlags() const

### `[read-only]` filePath : const QUrl

Returns the file path this file system access request is referring to.

Access functions:

QUrl | filePath() const

### `[read-only]` handleType : const HandleType

Returns the type of the requested file system entry. (File or directory)

Access functions:

QWebEngineFileSystemAccessRequest::HandleType | handleType() const

### `[read-only]` origin : const QUrl

This property holds the URL of the web page that issued the file system access request.

Access functions:

QUrl | origin() const

## Member Function Documentation

### `[invokable]` void QWebEngineFileSystemAccessRequest::accept()

Accepts the request to access local files.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

### `[invokable]` void QWebEngineFileSystemAccessRequest::reject()

Rejects a request to access local files.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

## Related Non-Members

### `[noexcept]` bool operator!=(const QWebEngineFileSystemAccessRequest &lhs, const QWebEngineFileSystemAccessRequest &rhs)

Returns `true` if lhs and rhs point to different requests.

### `[noexcept]` bool operator==(const QWebEngineFileSystemAccessRequest &lhs, const QWebEngineFileSystemAccessRequest &rhs)

Returns `true` if lhs and rhs both point to the same request.