Loading

Salesforce Files: Troubleshooting Missing File Previews Due to MIME-Type Mismatch

Julkaisupäivä: Jun 21, 2026
Kuvaus

Issue

Files uploaded to Salesforce may fail to generate proper previews when the file's MIME-type does not match its file extension, or when the file format is not supported by Salesforce's preview service.

Symptoms

  1. Downloaded files display correctly, but file previews are not generated in Salesforce.
  2. Preview generation fails entirely for certain file types.

Cause

If previews are not generated, it is typically due to one of the following reasons:

  1. The file contains content that does not match its declared file extension (MIME-type mismatch).
  2. The file was custom-generated and does not conform to standard document specifications.

Ratkaisu

Step 1: Verify File Format Support

Check if your file type is supported by Salesforce's preview service. Salesforce supports previews for specific file types as documented in the Content Preview help page.
Supported file types include:

  • Microsoft Word documents (.doc, .docx)
  • Microsoft Excel spreadsheets (.xls, .xlsx)
  • Microsoft PowerPoint presentations (.ppt, .pptx)
  • PDF documents (.pdf)
  • Images (.jpg, .jpeg, .png, .gif)
  • Text files (.txt)

Step 2: Check MIME-Type Consistency

Verify that your file's MIME-type matches its file extension.
On Unix, Linux, or Mac systems: You can check a file's actual MIME-type by running the file --mime-type command followed by the filename in your terminal. For example, a correctly formatted .doc file should return application/msword. If it returns text/html, the file content does not match its extension and Salesforce will not be able to generate a preview for it correctly.
On Windows systems: You can use PowerShell's Get-ItemProperty command or a third-party file inspection tool to verify a file's MIME-type. Alternatively, try opening the file in its native application — if it opens incorrectly or shows unexpected content, the file content is likely mismatched with its extension.
Common MIME-Type Mappings:

  • .doc files should have MIME-type: application/msword
  • .docx files should have MIME-type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
  • .pdf files should have MIME-type: application/pdf
  • .html files should have MIME-type: text/html

Step 3: Verify Previews by Re-uploading the File

  1. Re-upload the problematic file as a new version of the existing ContentDocument, then check if previews are generated.
  2. Upload the file to a sandbox org on a different Salesforce instance and verify whether previews are generated.

If the problem persists and the file is confirmed to be in a supported format, contact the Salesforce Support team for further assistance.

Knowledge-artikkelin numero

005227030

 
Ladataan
Salesforce Help | Article