How to disable attachment uploads when Confluence is read-only
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
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 Answers or consider working with an Atlassian Solution Partner.
Purpose
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:
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.
- Ensure that you've followed one of the methods outlined in this KB article to set your Confluence instance as Read-Only.
- Stop Confluence.
Navigate to <Confluence-Installation>/confluence/pages folder.
Modify the viewattachments.vm file by commenting the following section:
#if( $action.hasAttachFilePermissions() ) <div id="upload-div" class="attachment-section"> #parse ("/pages/uploadattachments.vm") </div> #end
- Restart Confluence.