When I try to replace the file with newer version of it (with same name), the file in filefield have wrong filename and dead link.

How to reproduce:
1. Upload a file to a filefield (for example, "test2.txt")
2. Save the node
3. Go to edit form
4. Press "Remove" in filefield
5. Upload file "test2.txt" again
6. Press Save.

After that in folder I see file "test2_0.txt" and "test2.txt" is deleted, but in node I see the link to file "test2.txt" that isn't exists.

If I press "Save" and after that - "Edit" between 4 and 5 steps, all works good.

Comments

markDrupal’s picture

I'm not able to reproduce this error. This is the basic functionality of the module and it works when I tried it.

You should check your temp file directory "admin/settings/file-system" and see if the file gets moved there. It is possible that the file gets moved to the temp directory but you don't have permissions to write or read the temp directory. Again, it should fail with an error, so I'm not sure what is happening for you.

markDrupal’s picture

Status: Active » Postponed (maintainer needs more info)
murz’s picture

Version: 6.x-1.0-rc5 » 6.x-1.0

It is reproducible for me on latest version with fresh site with installed modules:
Drupal core modules 6.14
CCK 6.x-2.5
Upload replace 6.x-1.0
All other modules is off.

Algoritm to reproduce:
1. Create new node with filefield field (number of files - 1).
2. Upload file "test4.txt" to filefield.
3. Save the node.
You see the correct link to the file: files/test2/test4.txt
5. Press "Edit" on this node.
6. Press "Remove" button on filefield.
7. Press "Browse" button and select "test4.txt".
8. Press "Upload". In widget you will see the link: files/test2/test4_0.txt
This link is works normally.
9. Press "Save" button for node.
10. Look at the link in filefield - it becomes: files/test2/test4.txt but this link is broken, file is still files/test2/test4_0.txt in filesystem!

murz’s picture

Status: Postponed (maintainer needs more info) » Active
markDrupal’s picture

Status: Active » Fixed

Thanks, I found the problem with sites with revisioning disabled.
Adding a hook_file_delete allowed me to update the file path before the delete occurs.
Anyways I was able to fix this issue and committed to 1.1

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

sidharthap’s picture

I tried with the above solutions but no result. same problem occurs.