Upload attachment function does not work in editing mode
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
Unable to upload attachments from the Editor via either:
Edit page > Insert > Attachment
Edit page > Insert > Image
Edit page > Insert files and images > click on Upload files
You get the error message: "Could not upload the file to Confluence. The server may be unavailable."
Note: sometimes the attachment will upload despite the warning.

You can successfully upload attachments from Tools > Attachments > Attach File.
Diagnosis
The following appears in the atlassian-confluence.log
:
012-09-18 19:06:10,170 ERROR [http-8090-4] [atlassian.confluence.servlet.ConfluenceServletDispatcher] serviceAction There is no Action mapped for namespace /confluence/pages and action name attachfile
-- url: /confluence/pages/attachfile.action | userName: florianmayer | referer: http://atlassian.net:8090/pages/createpage.action?spaceKey=ds&fromPageId=121962498
2012-09-18 19:07:19,242 ERROR [http-8090-4] [atlassian.confluence.servlet.ConfluenceServletDispatcher] serviceAction There is no Action mapped for namespace /confluence/pages and action name attachfile
-- url: /confluence/pages/attachfile.action | userName: florianmayer | referer: http://atlassian.net:8090/pages/createpage.action?spaceKey=ds&fromPageId=121962498
2012-09-18 19:09:18,465 ERROR [http-8090-4] [atlassian.confluence.servlet.ConfluenceServletDispatcher] serviceAction There is no Action mapped for namespace /confluence/pages and action name attachfile
-- url: /confluence/pages/attachfile.action | userName: florianmayer | referer: http://atlassian.net:8090/pages/createpage.action?spaceKey=ds&fromPageId=121962498
Additional diagnosis:
Open the Browser Developer tools to the Network tab
On the Edit screen load, check if there are any HTTP failures on any batch.js calls after the resources call:
Look for any errors such as HTTP 400, HTTP 0 on the batch.js calls
Cause
The configured base URL does not match the URL you use to access Confluence via the browser. For example, you access Confluence via
http://atlassian.net:8090 while the configured base URL from
Confluence Admin > General Configuration
is http://atlassian.net/confluenceThere is also a known bug. Follow its progress here: CONFSERVER-28564 - Uploading attachments through the "insert link" macro fails if it uploads too slowly.
This has also been reported in legacy versions of Confluence (e.g. Confluence 5.6.X) caused by the Brikit Theme Press.
IIS has a maximum URL length restriction causing long URLs to fail with a HTTP 400.
Antivirus scanners such as Symantec endpoint and/or Trend Micro are running on the Confluence Server.
Solution
Solution 1
Ensure that the configured base URL must match the URL you use to access Confluence via the browser. Update the Base URL from Confluence Admin > General Configuration.
Also check that the <confluence-install-dir>/conf/server.xml
has the relevant proxyName, proxyPort and scheme tags. Refer to the relevant Proxy and HTTPS setup for Confluence guides.
Solution 2 - IIS
2.1. IIS not using AJP worker
Open up IIS Manager
Navigate to the Confluence "site"
Right click and clickExplore
Edit the web.config file in a text editor
Make sure in the <system.web> block, there is a value for maxUrlLength="4096", e.g.
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> ... </rewrite> <security> ... </security> </system.webServer> <system.web> <!-- This keeps IIS from complaining about special characters in the url. Also has some controls for max upload size. Set to the equivalent of the above, but in kilobytes instead of bytes. (ex. 61440 = 60MB) --> <httpRuntime executionTimeout="20" maxUrlLength="4096" maxRequestLength="100000" requestPathInvalidCharacters="" requestValidationMode="2.0" /> <pages validateRequest="false" /> </system.web> </configuration>
Once the above is done, restart the "IIS service" for the change to take effect
2.2. IIS is using AJP worker
Open up regedit.exe from Start Menu on the Windows IIS Server
Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters
Create a new DWORD (32-bit) value
Name: UrlSegmentMaxLength
Value: 1000 (hex) or 4096 (decimal)
Reboot the entire Windows machine for the registry change to take effect
Solution 3
As per Using Antivirus software with Confluence:
Disable/Uninstall Symantec Endpoint and/or Trend Micro antivirus scanner from the Confluence Server; or
Exclude The Tomcat listening port from being scanned; or
Edit the Trend Micro AV / URI Length and Depth restriction rule to allow long URI length (e.g. set to 1024):
Workaround
Enable Safe-Mode and see if the upload functionality works after disabling third party add-ons.
Was this helpful?