Upload File Replace (for filefield CCK)

markDrupal - July 10, 2009 - 16:27

#D7CX : I pledge that Upload File Replace will have a full Drupal 7 release on the day that Drupal 7 is released.

This module is a small tool that allows uploaded files to retain their original name on upload.

REQUIREMENTS
Drupal 6.x requires the filefield CCK. (http://drupal.org/project/filefield)
Drupal 7.x no known requirements.

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

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.

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.

Releases

Official releasesDateSizeLinksStatus
6.x-1.12009-Oct-298.8 KBRecommended for 6.xThis is currently the recommended release for 6.x.
Development snapshotsDateSizeLinksStatus
7.x-1.x-dev2009-Oct-308.16 KBDevelopment snapshotDevelopment snapshots are automatically regenerated and their contents can frequently change, so they are not recommended for production use.


 
 

Drupal is a registered trademark of Dries Buytaert.