I have a fairly large site that is using Safecracker File for quite a few fields. Some of the entries have files that get updated each month. The issue is that "removing" a file from an entry does not delete and replace the file on the server so if you are trying to attach a file with the same filename as the file already uploaded, the new file will get renamed by EE on upload.

That's usually not a problem, but the client has a case where they do not want the filename to change because they want to share a direct link to the file with their team - and they don't want to have to reshare the link each time the entry is updated.

For example, this month they share a link to "Marketing-Presentation.ppt" file


Then next month when it's updated, the client uploads the new file... but the new file has a 1 appended to the filename... so the new link is the one below but the link shared last month no longer links to the latest version of the file.


Here's what I'm thinking so far...

  • Is there a file fieldtype that will delete and replace the existing file rather than just upload and rename?
  • Perhaps the best way to solve this is to give the client another way to share direct download links that do not contain the file name.

I'd like to hear your insights on either of those approaches or something else I'm not thinking about.

2 Answers 2


Instead of sharing the url to the file itself, share the url to an entry which provides a download link to the file "attached" to it.

The site admins would upload/attach the file to an entry. If the file needed updating they would edit the existing entry and upload a new file. The name of the file wouldn't matter as that would not be shared. The url to the entry would never change.

On your front-end the template could either show a download link or automatically trigger a download of the file attached to the entry.

  • 1
    I wanted to avoid the extra click to download so maybe I'll try your idea to do automatically trigger the download. This approach could work quite easily because there is only one file uploaded per entry. Commented Jan 15, 2013 at 18:04

While it's still brand new and bound to have some issues, which you can probably track here, it does sound like Assets v 2.0 will allow you to do this.

See sections on Conflict Resolution and Lossless File Replacement from the new Pixel and Tonic blog post, but quoted here for easy reading:

Conflict Resolution When you upload a file with the same name as an existing file, Assets now lets you chose how to proceed. You can rename the new file, replace the original file, or cancel the upload. We didn’t stop at file uploads: you’re given similar choices any time you perform any action which would result in two files or folders with the same name living in the same directory.

followed by

Lossless File Replacement You can now replace existing files while preserving the original file’s metadata and entry associations. Simply upload a new file with the same name as the original. When you’re asked how you want to handle the naming conflict, choose to replace the original file, and presto: new file, same old metadata.

I think those two options, would easily allow the replacement of the file and still maintain any data associated with it.

  • Thanks for the heads up on this. Assets 2.0 looks the most promising for this particular situation. I'll just need to figure out how to convert all the Safecracker File fields to Assets. Commented Jan 16, 2013 at 12:51
  • I could be wrong, because I switched from just the regular 'File' field_type, but I believe you can just change 'field_type'. I'd test it, but I believe Safecracker File, just gives you a more flexible front-end form interface, but still uses {file_dir_##}/filename.png process internally. It says, "Added support for simple HTML file field uploads via SafeCracker". Commented Jan 16, 2013 at 14:40
  • I already asked PT and they said I should first change my Safecracker File fields to native File fields... then change them to Assets and it will all migrate. I'll be testing this soon. Commented Jan 16, 2013 at 19:47
  • That makes sense. Good luck! Commented Jan 16, 2013 at 20:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.