How to disable attachment uploads when Confluence is read-only

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

The content on this page includes steps to customize or extend Atlassian software (adding/changing CSS rules, HTML, JavaScript, etc.). Per the Atlassian Support Offerings, support does not include customizations made to Atlassian products. Be aware that this material is provided for your information only and using it is done so at your risk.

If you have any questions about this or any customization, please ask the community at Atlassian Community or consider working with an Atlassian Solution Partner.

The information on this page does not apply to sites running Confluence Data Center 6.10 or later, which provides the ability to make your site read-only. See Using read-only mode for site maintenance for more information.

If you want to disable the attachments upload feature in a Confluence instance where the read-only mode feature is not available, the workaround below may work for your site:

Solution

Workaround

Code Changes Required

This configuration requires changing the Confluence code in your installation. You will need to reapply these changes whenever you upgrade Confluence. Proceed with caution.

  1. Ensure that you've followed one of the methods outlined in this KB article to set your Confluence instance as Read-Only.

  2. Stop Confluence.

  3. Navigate to <Confluence-Installation>/confluence/pages folder.

  4. Modify the viewattachments.vm file by commenting the following section:

    1 2 3 4 5 #if( $action.hasAttachFilePermissions() ) <div id="upload-div" class="attachment-section"> #parse ("/pages/uploadattachments.vm") </div> #end
  5. Restart Confluence.

Updated on April 15, 2025

Still need help?

The Atlassian Community is here for you.