Download & Extend

Upload File Replace (for filefield CCK)

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

<newest>-------------------------------<older>-------------------------------<oldest>
mydoc_3.doc ------ mydoc_2.doc ------ mydoc_1.doc ------ mydoc_0.doc ------ mydoc.doc

Behavior with this Module

<newest>-------------------------------<older>-------------------------------<oldest>
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.

REQUIREMENTS

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. (http://drupal.org/project/filefield)
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.

Downloads

Recommended releases

Version Downloads Date Links
7.x-1.0-beta1 tar.gz (9.13 KB) | zip (9.97 KB) 2011-Dec-15 Notes
6.x-1.2 tar.gz (8.98 KB) | zip (10.14 KB) 2009-Dec-30 Notes

Development releases

Version Downloads Date Links
7.x-1.x-dev tar.gz (9.12 KB) | zip (9.97 KB) 2011-Dec-15 Notes

Project Information


Maintainers for Upload File Replace (for filefield CCK)

  • markDrupal - 12 commits
    last: 2 years ago, first: 2 years ago

Issues for Upload File Replace (for filefield CCK)

To avoid duplicates, please search before submitting a new issue.
All issues
Bug reports
Oldest open issue: 17 Feb 10
nobody click here