Loading

Salesforce Attachment Does Not Open Properly in Chrome — Incorrect ContentType (MIME Type) on Attachment Records

Дата публикации: Jun 1, 2026
Описание


Attachments — such as PDF files — may display as random text in Chrome rather than rendering the file content correctly. This occurs when the ContentType (also called the MIME type — Multipurpose Internet Mail Extensions) field on the Attachment record is missing or set to an incorrect value.

This behavior is not present in other Supported Browsers such as Firefox, Microsoft Edge (Chromium), and Safari, where the attachment opens without an issue.

This article explains how to identify and correct the ContentType value on existing Attachment records, and provides a workaround using Salesforce File Upload and Download Security Settings.

Решение


Option 1: Update Custom Code or Contact Your Third-Party Package Vendor

If PDF attachments are being inserted via custom code or a third-party package using the API, update the underlying custom code or contact the package vendor to ensure the attachment ContentType field is set correctly on insert.

The ContentType field must be set to the correct MIME type value at the time of creation. For PDF files, this value is application/pdf.

Common ContentType (MIME type) values:

  • PDF = application/pdf
  • JPG = image/jpeg
  • ZIP = application/zip

For other file extensions, refer to Media Types. If you are unsure of the correct value, upload a sample file through the Salesforce User Interface and then check its corresponding ContentType value after upload.

Option 2: Update Existing Attachment Records via Data Loader or API

For existing Attachment records that are already affected, perform an update operation via the Attachment object API using Data Loader or another API client tool to correct the ContentType field values.

After updating affected attachment records, users may need to clear their browser's cache, or verify the attachments are opening properly using Chrome's Incognito mode.

Note: Custom code, integrations, and third-party application vendors must ensure ContentType values are set with the correct MIME type on insert or update of Attachment records via the API.

Option 3: Configure File Upload and Download Security Settings as a Workaround

If it is not possible to update custom code, and the attachment upload needs to be fixed by a third-party vendor, a Salesforce Administrator may use Configure File Upload and Download Security Settings to set the download behavior for each affected file type to 'Hybrid'. This forces Salesforce to download the file rather than render it within the browser.

If none of these options are applicable, please log a case and ask Support to refer to the Internal Information section of this article to discuss potential options.

Номер статьи базы знаний

000381189

 
Загрузка
Salesforce Help | Article