upload.getFile #

Returns content of a whole file or its part.

Layer 223

upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File;
upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes file_hashes:Vector<FileHash> = upload.File;
---functions---
upload.getFile#be5335be flags:# precise:flags.0?true cdn_supported:flags.1?true location:InputFileLocation offset:long limit:int = upload.File;

Parameters #

NameTypeDescription
flags#Flags, see TL conditional fields
preciseflags.0?trueDisable some checks on limit and offset values, useful for example to stream videos by keyframes
cdn_supportedflags.1?trueWhether the current client supports CDN downloads
locationInputFileLocationFile location
offsetlongNumber of bytes to be skipped
limitintNumber of bytes to be returned

Result #

upload.File

Both users and bots can use this method #

Possible errors #

CodeTypeDescription
400CDN_METHOD_INVALIDYou can't call this method in a CDN DC.
400CHANNEL_INVALIDThe provided channel is invalid.
400CHANNEL_PRIVATEYou haven't joined this channel/supergroup.
406FILEREF_UPGRADE_NEEDEDThe client has to be updated in order to support file references.
400FILE_ID_INVALIDThe provided file id is invalid.
400FILE_REFERENCE_EMPTYAn empty file reference was specified.
400FILE_REFERENCE_EXPIREDFile reference expired, it must be refetched as described in the documentation.
400FILE_REFERENCE_INVALIDThe specified file reference is invalid.
420FLOOD_PREMIUM_WAIT_%dPlease wait %d seconds before repeating the action, or purchase a Telegram Premium subscription to remove this rate limit.
400LIMIT_INVALIDThe provided limit is invalid.
400LOCATION_INVALIDThe provided location is invalid.
400MSG_ID_INVALIDInvalid message ID provided.
400OFFSET_INVALIDThe provided offset is invalid.
400PEER_ID_INVALIDThe provided peer id is invalid.

Encrypted CDNs for Speed and Security #

How client apps download popular public files from secondary CDN data centers.

File references #

How to handle file references.

Telegram Premium #

Telegram Premium is an optional subscription service that unlocks additional exclusive client-side and API-side features, while helping support the development of the app.