In Drupal 7, the default path for uploading is set in the File system options in the Public file system path. Is it possible to specify a different server in this path? I have a Drupal 7 web site we are developing that is going to have about 20k files and I'd like to put them on a different server than the web server. If not possible to specify a different server than are there any user contributed modules that can handle this?

  • Have you completed this Task.
    – Cindrella
    Commented Oct 16, 2012 at 7:07
  • Any module regarding this? Commented Jul 17, 2017 at 12:38

3 Answers 3


I do something very similar. If you're running infrastructure that is capable of this configuration, I recommend serving up a share on your file server (Linux or Windows Server) and just mount it in Drupal's public file path, wherever the public directory is for that particular field.

For example, take the following Samba configuration (found in /etc/samba/smb.conf if you run a Linux-based file server). This comes at the very end of the file after all other configuration options:

    comment = Data directory
    browseable = yes
    writable = yes
    valid users = "@DOMAIN\Domain Admins"
    path = /data
    create mask = 0664
    force create mode = 0664

The valid users syntax there says "allows this group of users" to access this share. In this case we're using PAM to hook up our file server to Active Directory, and this particular group is made available once you hook the two up.

On your web server, whatever is hosting your Drupal site, navigate to the public files directory. Say the particular field you need to make the files available for is public://field_with_20k_files/. You'd run a similar mount command like so:

sudo mount -t cifs -o user=domainadministrator,uid=domainadministrator,gid=apache //fileserver/data /path/to/field_with_20k_files

I have the gid set to whatever process is running the web server so it has access to that directory. Most likely you'll want to ensure that the web service has read and write access to the web server is actually capable of uploading files.

  • All the answers are good but since we have control of the infrastructure, this answer is the easiest and most straightforward from a Drupal standpoint to implement since we don't have to install any new modules. We're in a Windows environment but thanks for the incredibly detailed steps provided!
    – John81
    Commented May 8, 2012 at 17:14
  • In that case then you can basically just skip the Samba configuration and just run the mount command directly using a username and password that has the appropriate Windows permissions setup. Let me know if you have any questions. Commented May 8, 2012 at 17:16
  • I'm trying to do this, but I'm having issues. My service center was able to mount the Windows server, but we didn't know where to go from there. I tried to use /mount_file_path as the public file directory, but I get an error that it doesn't exist and could not be created.
    – nmillin
    Commented Aug 28, 2012 at 10:56

Also an excellent option would be the Storage API. Here is a quote about it (from the module's project page):

... is a low-level framework for managed file storage and serving. Module and all the core functions will remain agnostic of other modules in order to provide this low-level functionality. Submodules are welcome to allow Storage API to interact with other contributed modules, but there shall never be a dependencies[] statement in the storage.info file unless it is necessary for the low-level function of this module.

It has the following features:

  • Pluggable architecture - it can be extended to work with any storage service.
  • Redundancy - it can be configured to store your files in multiple services and instantaneously change which one is serving. This means your site will not be brought down by a service having problems.
  • Access control API - can be used for e-commerce.
  • Deduplication - when files that are identical are stored in the same container, only one instance will be created. This saves bandwidth and storage.
  • File and image field integration - enable the "core bridge" sub-module.
  • Audit module - compares a manifest of files with what is recorded in the database to ensure that the record is accurate.

Two modules that may also help in this area are CDN (used by many big sites, including Economist.com) and Amazon S3 (specifically for using Amazon S3 instead of the local file system).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.