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.
Hi,
Some files have been deleted from the my server.
When I go to a node with a missing file, I have a "?" instead.
If I try to reUpload this file, the upload seems to work, I save the node and… always the "?" and on the directory no files uploaded…
However if I edit the node, remove the missing file, save the node, reEdit, upload and save, no problem !
It is a known bug or I miss something ?
Thanks
Comments
Comment #1
quicksketchIt's not a bug necessarily, it's just that FileField isn't capable of keeping track of files that have been deleted from your server manually. In addition to the file existing on disk, there is also a row for the file in the "files" database table. If that row still exists in the database but the file is not on disk, you won't be able to upload a file with the same name because a row already exists in the database for that file. As you found, you can work-around this problem by removing the existing file first in the UI (which deletes the matching table row) and then re-upload the file. To prevent this problem in the future, don't delete files directly off of the disk unless you're also going to clean up all the matching rows in the database.