Class: QgsFileUploader

A utility class for uploading files.

To use this class, it is necessary to pass the URL and a the file name of the file to upload as arguments to the constructor, the upload will start immediately.

The upload is asynchronous.

The object will destroy itself when the request completes, errors or is canceled. An optional authentication configuration can be specified.

Added in version 4.2.

List of all members, including inherited members

Class Hierarchy

Inheritance diagram of qgis.core.QgsFileUploader

Base classes

QObject

Methods

cancelUpload

Call to abort the upload and delete this object after the cancellation has been processed.

startUpload

Called to start the upload

Signals

uploadCanceled

Emitted when the upload was canceled by the user.

uploadCompleted

Emitted when the upload has completed successfully

uploadError

Emitted when an error makes the upload fail

uploadExited

Emitted always when the uploader exits

uploadProgress

Emitted when data are ready to be processed

class qgis.core.QgsFileUploader[source]

Bases: QObject

__init__(uploadFileName: str | None, url: QUrl, formName: str | None = '', authcfg: str | None = '', delayStart: bool = True)

QgsFileUploader

Parameters:
  • uploadFileName (Optional[str]) – file name of the file to upload to the server

  • url (QUrl) – the upload URL

  • formName (Optional[str] = '') – the upload URL

  • authcfg (Optional[str] = '') – optionally apply this authentication configuration

  • delayStart (bool = True) – if True, the download will not be commenced immediately and must be triggered by a later call to startUpload(). This can be useful to setup connections

cancelUpload(self)[source]

Call to abort the upload and delete this object after the cancellation has been processed.

See also

uploadCanceled()

startUpload(self)[source]

Called to start the upload

signal uploadCanceled[source]

Emitted when the upload was canceled by the user.

See also

cancelUpload()

signal uploadCompleted(url: QUrl)[source]

Emitted when the upload has completed successfully

Parameters:

url (QUrl)

signal uploadError(errorMessages: List[str])[source]

Emitted when an error makes the upload fail

Parameters:

errorMessages (List[str])

signal uploadExited[source]

Emitted always when the uploader exits

signal uploadProgress(bytesSent: int, bytesTotal: int)[source]

Emitted when data are ready to be processed

Parameters:
  • bytesSent (int)

  • bytesTotal (int)