Salesforce has had three file storage systems over the years and they overlap awkwardly.
- Attachments (the oldest) — stored as the
Attachmentobject, related to a single record. No versioning, no sharing beyond the parent record's sharing, capped at 25 MB per attachment. Considered legacy; new functionality typically doesn't write Attachments anymore. - Salesforce Files (the modern way) — stored via
ContentDocumentandContentVersion, accessible from the Files tab. Files can be shared with multiple records, with users, and with public links. Versioning is built in. 2 GB per file limit. Replaces Attachments for almost every use case. - Salesforce CRM Content — an older variant of Files, built for content libraries with per-folder permissions. Largely subsumed by Files now but still alive in older orgs.
The data model: a ContentDocument represents a file, a ContentVersion is a specific version of that file, and ContentDocumentLink links a ContentDocument to a record (Account, Opportunity, Case, etc.). One File can be linked to many records.
Practical guidance:
- New orgs / new functionality — always use Files (
ContentDocument). - Legacy data — Attachments may still exist; you can run a one-off migration to convert them to Files using Apex or a managed package.
- Storage — File storage is separate from Data storage; both have their own caps.
Common gotcha: Files vs Attachments behave differently in Lightning Experience — the "Notes & Attachments" related list shows Attachments, while "Files" shows Salesforce Files. Old records might have data in both.
