About files

In Acquia Cloud, uploaded files are separate from the Drupal database and your code repository. Acquia Cloud deployment code creates a symbolic link to your website's /files directory. If you use Drupal's multisite feature, Acquia Cloud creates a separate /files directory for each settings.php file in the /sites directory.

On Acquia Cloud, you manage your Drupal codebase (including Drupal core, contributed modules, and custom code) using either the Git or Subversion (SVN) version control system. Git and SVN can manage text files full of code, but is not suitable for large collections of user-uploaded objects. Acquia Cloud stores your website's /files directories outside of your repository and manages them for you. This simplifies your workflow and makes your repository smaller and more manageable. To access your website's /files directories, use the sftp, scp, rsync, or ssh commands.

An Acquia Cloud Enterprise website runs on several redundant web nodes (servers) simultaneously. If the site used local file storage on the web notes, files uploaded to one web node would not be available on another. Acquia Cloud Enterprise uses shared file systems to ensure that data your code writes to a /files directory is accessible on all web nodes running your website's code.

When you import your Drupal codebase, Acquia Cloud creates symbolic links to your public file directory. Note that every Drupal multisite website in your account has its own /files directory.

  • [docroot]/files links to /mnt/files/[site].[env]/files
  • [docroot]/sites/default/files links to /mnt/files/[site].[env]/sites/default/files
  • [docroot]/sites/example.com/files links to /mnt/files/[site].[env]/sites/example.com/files

To ensure its privacy, the /files-private directory is not symbolically linked to your website's [docroot]. You need to use the absolute path to [docroot] for any private file handling.

Downloading large files

Drupal websites on Acquia Cloud support downloads of files of any size. However, large downloads require a correct Content-Length header in the HTTP response in order to succeed. For any static file, the Apache web server in the Acquia Cloud stack will provide the correct header. If the download is large (1 GB or more) and is dynamically generated (for example, generated by a PHP script), the download is likely to fail unless a Content-Length header is explicitly provided.

Large numbers of files

If you maintain a very large number of files on your website, it can have a substantial negative effect on performance and stability, especially if they are all contained in the same directory. We have found that over 2500 files in any single directory in the files structure can seriously impact your server's performance and potentially its stability. If your site requires a large number of files, maintain them in multiple directories. For more information about files and performance, see Improving website performance, Proactively organizing files in subfolders, and Optimizing file paths: Organizing files in subfolders, which includes scripts for migrating files into subdirectories in your file system.

You should also consider using an external storage solution, such as Amazon S3. For more information, see Using external storage for files.

Related Topics

Sign in to vote or comment