Is there a way to stop Drupal from renaming a file that has already been uploaded via File Attachments or FCKeditor?

For example, when editing a node if you go down to File Attachments and upload a file (such as example.doc) with a filename that has already been uploaded to the destination folder, it will get renamed (example_0.doc). Is there a way I can overwrite the old file instead of renaming the new one?

Comments

ccleveland’s picture

I am also searching for a solution for this 'feature'

I have limited filespace on my host, duplicating +1Mb files (photo images) could eat up the available space very quickly,
overwrite option would be better for me with this hosting plan =)

[edit] just to clarify matters, i guess we are talking about the core upload module here (i am) and the lack of an option to switch between rename and overwrite when a file with the same name already exists..
i have just read that IMCE has this functionality, but i haven't tested that yet

kitsunechan’s picture

I use IMCE but it, too, just renames the file instead of overwriting it. IMCE does give you the ability to delete files though, so you can manually delete the old file then upload the new one.

mm167’s picture

there are many modules that provide file upload features, say attachment, FCKeditor, MCEditor ..etc.

rename or replace is a "default" setting of the module u are using.

u may need to name the module u are using in order to get an exact answer and solution.

good day.

Pucca’s picture

I know this is a old discussion, by please let me know how to change this in FCKEditor. When uploading .pdf's with the same name (using the wysiwig editor), it renames it. I want it to replace the existing file.
Please help.

mikebann’s picture

I'm having the same issue with the file upload module built into drupal core of 6.x. I've done a ton of research aned trouble shooting and found no solution. It seems odd that drupal can't do this and infact makes it difficult to program around it. I've looked through this file"upload.admin.inc" and can't find any code that looks like it's renamig the file. Does anyone know where the file is renamed?

mikebann’s picture

except it doesn't work with the core file upload module. I am trying to figure out how to add a filefield to a page because I've installed this module. Thanks it is a viable alternative

WillHall’s picture

Add the field with CCK - then customize the node template to display it as needed.

mikebann’s picture

Perfect thanks I appreciate the help

Sree’s picture

Thanks for this module.

-- Sree --
IRC Nick: sreeveturi

imoghis’s picture

I agree I need to be able to overwrite the file... it is very simple. Help!

vm’s picture

the want may be simple, but the end result isn't according to https://www.drupal.org/node/427212

also of note commenting on a 6 year old thread is only beneficial if you take the time to state the version of Drupal in use and what component is problematic. Best to start a new thread in most cases.