Greetings,

Do the following to reproduce:

1. Create a node type with file field in a multiple mode.
2. Create a node of this type.
3. Upload several files and save the node.

I found that files are not deleted correctly in the following scenarios:

Removing files from a node
-----------------------------------
1. Go to node edit page and remove all files.
2. Save the node.
PROBLEM: There are still not deleted records in the corresponding 'content_field' table (they are emptied but not deleted which is probably bad for multiple mode) as well as 'files' tables. Files are not physically deleted from 'files' folder.

Removing node
--------------------
1. Remove the whole node.
PROBLEM: Records are not removed from 'files' table and files are not physically deleted from 'files' folder. Records have been removed only from 'content_type' table.

Thank you.

Comments

neofactor’s picture

Confirmed... Was just about to post a bug myself.

drewish’s picture

Status: Active » Postponed (maintainer needs more info)

if you look in the files table are they still listed there? if so what's the value of the status field?

dopry’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

yeppers.. this is how the shared files currently work until there is a proper file manager available.

elly’s picture

What does this mean, exactly? I'm having the same issue, users are trying to delete & replace files with updated versions, and they aren't able to replace with files of the same name because the deleted files don't 'disappear.' So does this mean that this functionality will be available later on?

markDrupal’s picture

Version: 6.x-3.x-dev » 6.x-3.1
Status: Closed (works as designed) » Active

Still running into this problem. I need to be able to allow user to upload and replace files, however the file is not always replaced, usually it is renamed to _0.pdf

So now people who bookmarked the pdf file will either be
A) Downloading the old version of the file
B) Hitting a 404 Page not found because the new file has been renamed to _0.pdf

I can reproduce this error with the following steps

1> upload a file to a node, save it
2> edit the node, click "replace file"
3> upload the newer version of the file
4> hit save

Usually at this point the old file has been deleted, howerver if you are saving a new revision of the node, the old file remains until you delete that revision. Either way the newer file should keep the correct filename and the older file should be renamed or deleted.

quicksketch’s picture

This is not a bug, it is by design. See #427212: How to overwrite existing file? for another back-and-forth over this handling.

quicksketch’s picture

Status: Active » Closed (works as designed)
markDrupal’s picture

Since this is by design, I went and built a module to handle this for me: http://drupal.org/project/upload_replace
That module may be of use to someone who stumbles onto this page.

mani.atico’s picture

I'm running a site where user are free to upload and remove their uploaded files. I consider taht retaining those files after the user has decided to unpublished them is a privacy issue. Filefield should delete files after the node has been deleted.

mani.atico’s picture

Are there any initiatives or discussions about the file manager system mentioned on #3?

hawleyal’s picture

Is it possible to set up a Trigger/Action to delete the files upon the value/node removal?