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?
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:
[data] comment = Data directory browseable = yes writable = yes valid users = "@DOMAIN\Domain Admins" path = /data create mask = 0664 force create mode = 0664
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.
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.