I would like to know what happens if a user uploads an image by image
field but doesn't save that node?
It seems that image will be in the directory but no node refers to it. Is there anyway to remove such files?
The image files will be removed during cron runs.
This happens because the status
column in file_managed
for those files will still be zero, indicating that they're temporary, and can be safely removed after a period of time.
The responsible code is in system_cron()
, in case you need to reproduce/analyse further.
1
. I use https://www.drupal.org/project/bulk_file_nodes
module
Commented
Sep 23, 2015 at 9:47
0
...I think you'll want to talk to the maintainer of the module you're using if it's doing something different, I'm afraid I'm not familiar with it so can't comment
bulk_file_nodes
will assign 1
to files of unsaved nodes but the Drupal default image field assign 0
to it.
Commented
Sep 23, 2015 at 10:10
DRUPAL_MAXIMUM_TEMP_FILE_AGE