The Cloud Platform Enterprise platform uses two or more load balancing nodes to handle incoming requests, routing them to available application-layer infrastructure in a way that shares the load across multiple nodes. Cloud Platform Enterprise users may experience problems with file uploads on multi-node configurations. When Drupal temporarily uploads a file to a path that is not accessible by another web node that needs to access it, unexpected behavior may occur.
If this happens, Acquia recommends you to set the temporary files directory.
Another common cause for uploads to fail is very large file uploads. In this scenario, Acquia always recommends the use of a chunked upload module, which splits your large file into many chunks. If it is misconfigured, chunks scatter across multiple web nodes, making it impossible to ‘stitch’ the upload back together.
For large file uploads, use a contributed module for file uploads.
Setting the temporary files directory in settings.php
You can permanently set your website’s temporary files directory by adding a setting to the website’s settings.php
file after the Acquia include statement. The setting for you to use varies, depending on your Drupal version:
Use contributed modules for file upload handling
Contributed modules can be configured to help work around these issues on a permanent basis, which work by first creating a temporary file for each uploaded file. After the temporary file is on the infrastructure, the file is then moved to its final destination. For applications running on single-node Cloud Classic infrastructure, such as Cloud Platform Professional applications, this works without any errors. For applications running on Acquia Cloud Enterprise, however, you may experience errors when some of the uploaded files don’t save properly.
Files added by these modules to Cloud Platform Enterprise applications are saved to a temporary location that is not shared between the redundant provisioned infrastructure. It is possible for the move process to take place on a node that is different from the one that the file is uploaded to, which causes that move to fail and the upload to appear broken.
Acquia does not recommend a specific module because it often depends on the configuration of your Drupal site. Commonly-used modules include:
Plupload is a popular plugin to enhance the file upload experience on a website. Plupload is also a popular choice for Drupal-based websites. To add the plupload
library functionality to Drupal, you must install and enable the Plupload integration module.
In certain cases, the Webform module might show multi-node upload issues for users who upload content to a webform and for site administrators who export or download webform submissions.
To fix any issues with Webform exports, configure the temporary folder used by the Webform module by adding the following code to your Drupal settings.php file:
// Under Acquia Cloud, this will override the temporary folder used by the Webform module and might resolve issues around exporting. // See https://www.drupal.org/project/webform/issues/2980276 for more information. if (! empty($_ENV["AH_SITE_NAME"])) { $config["webform.settings"]["export"]["temp_directory"] = "/mnt/gfs/" . $_ENV["AH_SITE_NAME"] . "/tmp"; }
The Editor File upload module is compatible with the current Drupal version and CKEditor. It creates a button in the toolbar to link and upload data as part of content creation, rather than manually linking a file.
The Alternative Stream Wrappers module for Drupal allows Drupal to continue to use the built-in stream wrappers (such as public://
and temporary://
), but also use one or more alternative stream wrappers – for cases including the shared temporary directory.
For all appropriate modules, ensure that you configure the temporary files directory.
Alternative solutions
You can temporarily force all of your upload requests to the same node. To do this, Acquia recommends you to use one of the following methods:
- Pinning to an infrastructure without using the hosts file
- Using a temporary domain in your hosts file