I want to run a website which has more than 10000 files available for download.Is sites/default/files a good place to store the files? I see some websites store their files in someting like server1.example.com/file1.zip or drupal.org uses ftp for project files.

Which one should I use?


It depends on how do you want to manage/upload your files. You can put your files in sites/default/files but create a new vhost (with or without the same web server with your primary site) at files.example.com to give access to this folder. Also, it depends on whether you want access control to your files. If you don't want public access to those files, you should use the vhost, but use something like X-Sendfile header to reduce server load.

  • Files are public. – Nick.h Sep 2 '11 at 9:23
  • If I create a vhost how can I say to drupal show links in form of files.example.com instead of example.com/sites/default/files/...? – Nick.h Sep 2 '11 at 9:26
  • 1
    Maybe you need to create a module to serve you files by keys like files.example.com – Codium Sep 2 '11 at 11:28
  • 1
    You can change directly, don't you? Or use hook_url_outbound_alter to change your outbound url to files.example.com. – jcisio Sep 2 '11 at 12:00
  • 2
    Well, whatever, I think the subdomain is just minor problem. A bigger one is how to structure your file. Hierarchical folder is quite good, because to have 10K files in the same folder can be considered too many. Look at stackoverflow.com/questions/466521/… – jcisio Sep 2 '11 at 12:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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