Upload attachment function does not work in editing mode

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem

  • Unable to upload attachments from the Editor either via:
    • Edit page > Insert > Attachment
      or
    • Edit page > Insert > Image
      or
    • Edit page > Insert files and images > click on Upload files
    • You'll get the following error message:

      Could not upload the file to Confluence. The server may be unavailable.

      Note that sometimes the attachment will upload despite the warning.


  • However, you can successfully upload attachments from:
    • Tools > Attachments > Attach File

Diagnosis 1

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

Diagnosis 2

  1. Open the Browser Developer tools to the Network tab
  2. On the Edit screen load, check if there are any HTTP failures on any batch.js calls after the resources call:

    1. Look for any errors such as HTTP 400, HTTP 0 on the batch.js calls

Causes

  • 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/confluence
  • There is also a known bug. Follow its progress here: CONF-28564 - Getting issue details... STATUS
  • 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

Workaround

Enable Safe-Mode and see if the upload functionality works after disabling third party add-ons. 

Resolution 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.

Resolution 2 - IIS

2.1. IIS not using AJP worker

  1. Open up IIS Manager
  2. Navigate to the Confluence "site"
    • Right click and click Explore
    • 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>
  3. Once the above is done, restart the "IIS service" for the change to take effect

2.2. IIS is using AJP worker

  1. 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)
  2. Reboot the entire Windows machine for the registry change to take effect


Last modified on Apr 2, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.