This project is not covered by Drupal’s security advisory policy.

This is a small utility module that automatically stops Drupal from renaming new files upload via filefield CCK. When 2 files with the same name exist, the older files will be renamed.

What it Does

Default Drupal Behavior

mydoc_3.doc ------ mydoc_2.doc ------ mydoc_1.doc ------ mydoc_0.doc ------ mydoc.doc

Behavior with this Module

mydoc.doc ------ mydoc_3.doc ------ mydoc_2.doc ------ mydoc_1.doc ------ mydoc_0.doc

Why I Created this Module

The problem with drupal is if you have a file called "mydoc.doc" upload it to a node, then make changes to "mydoc.doc" and upload the newer version, the newer version will be renamed to "mydoc_0.doc" because at the time of upload the old file was blocking the desired path name.

This module solves that problem by swapping the names of the older and newer file so that the newly uploaded file will retain its original name.

This also works with node revisioning as well. When you revert a revision, the file names are swapped so the newest revision has the original filename.

After swapping revisions, the numbering may no longer hold any meaning, IE mydoc_0.doc may not be the oldest. But mydoc.doc will always be the most recent.

Similar modules

The renaming problem is common for others as well. Another module tries to solve this problem in a different way. Take a look and evaluate which module will work best for you.


This module works best when you have "Create new revision" enabled in the "workflow settings" in your content type settings page.
Without this setting enabled you will not have multiple versions of your file as suggested in the example below.
Note: This module will NOT modify any files uploaded by the Drupal 6.x Upload module.
Drupal 6.x requires the filefield CCK. (
Drupal 7.x no known requirements.

Known Issues for High Traffic Sites

This module modifies the files and those files may have been cached by modules such as 'imagecache' or Drupal's page cache, so this module clears the page cache, imagecache, and image_field cache when needed. This may have some performance side effects if your site has lots of visitors and lots of files being uploaded.

Project Information