In certain situations, it would be nice if files can be overwritten rather than have an additional file created with an incremental version number at the end of the filename. For example, when using IMCE, it would be nice not to force people to delete a file before uploading in order to avoid the incremented (in this case "_0") file name ending.

This patch adds a simple boolean parameter ($overwrite = FALSE) to file_create_filename().

CommentFileSizeAuthor
file.inc-overwrite.patch810 bytespcorbett

Comments

drumm’s picture

Version: 5.3 » 7.x-dev
Status: Needs review » Needs work

API changes are currently being considered for Drupal 7.x.

This should follow the existing API conventions for a $replace parameter, such as file_move() uses.

pcorbett’s picture

Would you like me to adjust this to follow conventions in file_move()?

dopry’s picture

Status: Needs work » Fixed

The file_destination function provides this functionality now.

Status: Fixed » Closed (fixed)

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