Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By NagareHoshi on
I want my module to delete all images that have been uploaded with its help and delete all database entries from 'file_managed' table on uninstall. I have no problem with the actual file deleting, but I'm stuck with database records deleting. I know there is a file_delete function that removes the database entry as well, but how is it possible to get the required fid then? Thanks in advance.
Comments
I think you should rather try
I think you should rather try to load the file by it's uri and then delete it via the file_delete() function. the file_delete() function will also physically remove the file.
That's a query I found in another comment somewhere:
So the only question / problem is to build the uri for a file, which should be straight-forwardish?
I like cookies!
Thank you very much for your
Thank you very much for your help!