Supported File Types
MadelineProto supports all Telegram media types:- Photos - Images up to 10MB
- Documents - Any file type up to 2GB (4GB for premium)
- Videos - Video files with optional streaming
- Audio - Audio files with metadata
- Voice - Voice messages
- Stickers - Static and animated stickers
- GIFs - Animated GIFs
- Round Videos - Video messages
File Input Types
Files can be specified using multiple input types:Sending Photos
Basic Photo Upload
Photo with Options
Sending Documents
Basic Document Upload
Document with Thumbnail
Sending Videos
Sending Audio
Sending Voice Messages
Sending GIFs
Sending Stickers
Downloading Files
MadelineProto provides multiple ways to download files:Download to Directory
Download to Specific File
Download as Stream
Get Download Link
Media Properties
Access media information:Media Type-Specific Properties
Photo Properties
Video Properties
Audio Properties
File Upload Progress
Track upload progress with callbacks:Reusing Uploaded Files
Reuse media from sent messages:Working with URLs
Upload files directly from URLs:Bot API File IDs
Use Bot API file IDs:Secret Chat Files
Files in secret chats are end-to-end encrypted:Best Practices
File Size Limits
File Size Limits
Respect Telegram’s file size limits:
- Photos: 10 MB maximum
- Documents: 2 GB (4 GB for Premium)
- Always check file size before uploading
Progress Callbacks
Progress Callbacks
Use progress callbacks for large files:
- Update user on upload/download status
- Show estimated time remaining
- Allow cancellation if needed
File Reuse
File Reuse
Reuse uploaded files when possible:
- Saves bandwidth and time
- Use message objects or Bot API file IDs
- Set
forceResend: falseto enable reuse
Streaming
Streaming
Enable streaming for videos:
- Set
supportsStreaming: true - Better user experience
- Videos can be played before fully downloaded