File
A File in Salesforce is a document, image, PDF, video, or other binary artifact stored on the platform.
Definition
A File in Salesforce is a document, image, PDF, video, or other binary artifact stored on the platform. Files are the modern file-storage primitive (replacing the legacy Attachment model since around 2014), backed by the ContentDocument and ContentVersion objects in the API. Every File has versioning support, sharing controls, preview generation, and metadata: title, description, type, size, owner. Users upload files through the Files tab, drag-drop on record pages, the Chatter composer, the mobile app, or external integrations.
Files are how Salesforce stores and surfaces documents alongside records. A Sales contract attached to an Opportunity, a Case-resolution PDF, an internal training video, a campaign creative asset, all live as Files. The platform supports preview rendering for common formats (PDF, Word, Excel, PowerPoint, images), full-text search of supported file types, and granular sharing through File Collaborators, File Viewers, File Owners, and library-based access control.
How Files work in Salesforce
ContentDocument versus ContentVersion
Files have two underlying objects. ContentDocument is the file''s metadata container: title, owner, latest version pointer. ContentVersion is each version''s actual bytes: VersionData blob, ContentSize, FileType, IsLatest. One ContentDocument has many ContentVersion records (one per upload). The platform shows users a single File; the data model preserves every version.
Files versus Attachments
Attachments are the legacy file model: simpler but lacking versioning, sharing, and preview. Files (Content/CRM Content) is the modern model. New uploads default to Files; existing Attachments stay in their object until migrated. The Convert Attachments to Files Lightning Component or Apex jobs handle migration when needed.
Sharing and permissions
Files have sharing models more granular than records. ContentDocumentLink records connect a File to a record (Account, Opportunity, Case), a User, a Group, or a Library. Each link has a permission: Viewer (read-only), Collaborator (read/edit), Owner (full control). The link''s ShareType determines this. Users with no link cannot see the File.
Storage and the File Storage allocation
Files count toward File Storage, a separate allocation from Data Storage (which holds records). Enterprise Edition includes 10 GB of file storage plus 2 GB per user license. Large media files (videos, high-res images) consume storage quickly; monitor at Setup, then Storage Usage.
Preview generation and search
Salesforce generates previews for common file types: PDF, Word, Excel, PowerPoint, images. The preview appears in the file viewer without downloading. Full-text search indexes file contents for the same supported types, so searching for an order number finds the PDF that contains it.
Libraries and centralized file management
Salesforce Files can be organized into Content Libraries: shared workspaces with their own access control, contributors, and content tags. Libraries are how marketing teams manage approved creative assets, how legal teams centralize templates, how training teams publish materials. Each Library has its own permission set independent of record-level sharing.
Files Connect and external file surfacing
Files Connect lets Salesforce surface files from external systems (SharePoint, Google Drive, OneDrive, Box) as if they were native Salesforce Files. The files stay in the source; Salesforce shows pointers. This extends the file model without consuming Salesforce file storage.
How to upload and share a File in Salesforce
Uploading a File takes one drag-and-drop in the Files tab or on any record page. Sharing is configured per File through ContentDocumentLink records, either via the UI or programmatically.
- Open the Files tab or a record page
Click the Files tab from App Launcher, or open a record (Account, Opportunity, Case) where you want to attach the file. The Files related list or the page''s drop zone is your upload target.
- Upload the file
Drag the file from your desktop onto the upload zone, or click Upload Files and pick from the browser. The file uploads; the platform generates a preview and indexes the content.
- Set sharing
After upload, the File is shared with the related record (if uploaded there) or with you alone (if uploaded to the Files tab). Click Share to add Collaborators, Viewers, or Library publishing.
- Edit File metadata
Click the file to open it; edit Title, Description, Tags. Add to Libraries if appropriate. The metadata appears in search and helps users find the File later.
- Upload a new version
To replace the File with a new version, click Upload New Version. The platform preserves prior versions; users see the latest by default but can access history.
- Search for the File later
Global search finds Files by Title, Description, Tag, and (for supported types) content. The Files tab also offers filtered list views.
The file''s display name. Defaults to the upload filename; editable after.
The user who uploaded the file. Has full control by default.
The actual file bytes. Stored on ContentVersion.
The format (PDF, Word, JPG, etc.). Drives preview behavior.
- Files counts toward File Storage, a separate allocation from Data Storage. Large file workloads need monitoring.
- File sharing is governed by ContentDocumentLink. A File with no link to a record or user is effectively orphaned; you may need explicit cleanup or sharing.
- Preview generation is asynchronous. Newly uploaded files may show no preview for a few minutes; the preview appears when generation completes.
- Files and Attachments are different objects. Code that queries Attachment misses Files entirely; migration helps consolidate.
Trust & references
Straight from the source - Salesforce's reference material on File.
- Files OverviewSalesforce Help
- ContentDocument ReferenceSalesforce Developers
About the Author
Dipojjal Chakrabarti is a B2C Solution Architect with 29 Salesforce certifications and over 13 years in the Salesforce ecosystem. He runs salesforcedictionary.com to help admins, developers, architects, and cert/interview candidates sharpen their fundamentals. More about Dipojjal.
Discussion
Loading discussion…