I want to offer a file download to my users, and I was thinking of using temporary:// to store the data. But how temporary is it? When do files disappear from it? Of course, I want to avoid having the file not be present when my user goes to download it jsut after a form submission, and I also want it gone after a while. So when do they go?


Temporary files that are created with the managed file functions are deleted when they are older than six hours, and during cron tasks.

The description for the FILE_STATUS_PERMANENT reports the following text:

Temporary files older than DRUPAL_MAXIMUM_TEMP_FILE_AGE will be removed during cron runs, but permanent files will not be removed during the file garbage collection process.

The value of DRUPAL_MAXIMUM_TEMP_FILE_AGE is 21600 (seconds), which means six hours.


From Admin UI
You can configure and check that from admin/config/media/file-system.

Using Drush
Also can be checked and adjusted using drush
drush cget system.file temporary_maximum_ageto check and drush cset system.file temporary_maximum_age 300 -y (To set the time 300 sec)

Also you can customize the setting with $config['system.file']['temporary_maximum_age'] = TIME_IN_SEC
in settings.php file.

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.