0

I am running a Drupal 9 site and I expect my users to upload a lot of files with the ckeditor functionality. All of those files will be stored in a single folder.

I heard that this will cause performance issue once there are a lot of files. To avoid this, I would like to include a timestamp in to the path where to file will be stored, similar to what Drupal does to regular file uploads.

Is there a way to achieve this?

I found this question but it's 5 years old and there is no real answer.

2
  • All of those files will be stored in a single folder. I heard that this will cause performance issue once there are a lot of files. No, not really. Whatever you heard, it is totally outdated or doesn't apply to default Drupal.
    – Hudri
    Sep 20, 2021 at 11:22
  • Premature optimization is the root of all evil 😈
    – leymannx
    Sep 20, 2021 at 16:44

1 Answer 1

0

Although stock Drupal may be OK with tons of files in a single directory, some Drupal hosts (e.g., Pantheon) have limits:

From their docs:

Highly Populated Directories

If you have individual directories with tens of thousands of files (e.g. an image repository) it may be necessary to refactor this file structure to see good performance on Pantheon. The danger zone begins at around 50,000 files in a single directory, and performance drops off suddenly at over 100,000 files.

Drupal itself is capable of managing uploaded content into different directories based on the date or user, which is preferable to dumping all uploads into a single place. Refactoring an existing large-scale site with this issue is usually simply a matter of re-arranging the files and then updating the files table in Drupal.

If you did need to implement this, you might look at what the Filefield Paths module does.

Your Answer

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

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