Skip to content

danog\MadelineProto\Settings\Files: File management settings.

Back to index

Author: Daniil Gentili daniil@daniil.it

File management settings.

Method list:

Methods:

getAllowAutomaticUpload(): bool

Get allow automatic upload of files from file paths present in constructors?

setAllowAutomaticUpload(bool $allowAutomaticUpload): \danog\MadelineProto\Settings\Files

Set allow automatic upload of files from file paths present in constructors?

Parameters:

  • $allowAutomaticUpload: bool Allow automatic upload of files from file paths present in constructors?

getUploadParallelChunks(): int

Get upload parallel chunk count.

setUploadParallelChunks(int $uploadParallelChunks): \danog\MadelineProto\Settings\Files

Set upload parallel chunk count.

Parameters:

  • $uploadParallelChunks: int Upload parallel chunk count

getDownloadParallelChunks(): int

Get download parallel chunk count.

setDownloadParallelChunks(int $downloadParallelChunks): \danog\MadelineProto\Settings\Files

Set download parallel chunk count.

Parameters:

  • $downloadParallelChunks: int Download parallel chunk count

getResumeInterruptedCalls(): bool

Get whether to resume interrupted calls that upload files after a restart.

setResumeInterruptedCalls(bool $resumeInterruptedCalls): \danog\MadelineProto\Settings\Files

Set whether to resume interrupted calls that upload files after a restart.

If enabled, method calls and sendMedia calls (sendDocument, sendPhoto, …) uploading a file that survives a restart
(a local file, a URL, a Telegram file or a resumable stream) are saved in the session until they complete:
if the session is restarted in the meantime, the call is made again once the session starts, resuming the interrupted upload.

Disable it if your code already makes interrupted calls again after a restart, to avoid sending files twice.

Parameters:

  • $resumeInterruptedCalls: bool Whether to resume interrupted calls that upload files after a restart

getSandboxDownloads(): bool

Get whether files served to browsers can’t run as pages of the website serving them.

setSandboxDownloads(bool $sandboxDownloads): \danog\MadelineProto\Settings\Files

Set whether files served to browsers can’t run as pages of the website serving them.

Applies to the files served by the download script (getDownloadLink, downloadToBrowser) and by downloadToResponse:
their MIME type and name come from whoever sent them on Telegram, or from the query string of the download script.
If enabled, they’re served with a sandboxing Content-Security-Policy and X-Content-Type-Options: nosniff, with
their MIME type normalized, and only media and plain text are shown inline (everything else is downloaded).

Disable it only if the files served are trusted, and must be shown as pages of the website (HTML, SVG, PDF…).

Parameters:

  • $sandboxDownloads: bool Whether files served to browsers can’t run as pages of the website serving them

getReportBrokenMedia(): bool

Get whether to report undownloadable media to TSF.

setReportBrokenMedia(bool $reportBrokenMedia): \danog\MadelineProto\Settings\Files

Set whether to report undownloadable media to TSF.

Parameters:

  • $reportBrokenMedia: bool Whether to report undownloadable media to TSF

getDownloadLink(): ?string

Get custom download link URL for CLI bots, used by getDownloadLink.

setDownloadLink(?string $downloadLink): \danog\MadelineProto\Settings\Files

Only needed for CLI bots, not bots started via web.

Sets custom download link URL for CLI bots, used by getDownloadLink.

Can be null, in which case MadelineProto will automatically generate a download link.

Parameters:

  • $downloadLink: ?string Custom download link URL for CLI bots, used by getDownloadLink.

Generated by danog/phpdoc