• Sitefinity Tips

Replacing Files in a Sitefinity Document Library


Avoid Multiple Copies of the Same File

Does this scenario sound familiar?

  • You upload a file
  • You decide to make and edit and update that file
  • You upload the file again (with a new filename like myfile-v2.pdf)
  • Perhaps that cycle repeats because even more edits and uploads take place
  • You now have multiple copies of the same file in your document library
Unlike your computer, when you add a file with the same name to Sitefinity it does not overwrite the old file with the new file. Instead, you end up with two files in your list that both have the same file name.

This may seem like counter-intuitive behaviour because you're not used to it, but there are some circumstances where you may not want to overwrite a file with the one that has the same file name. It is a good practice to give your files helpful names, but often with images in particular you end up keeping the default file name that was created by your camera.

Replace the file

To avoid multiple copies of the same file in Sitefinity there is an option to explicitly "Replace the file."  Here's how you do this:

  • From the document library or the image library click the file you want to replace
  • On the right side of the properties screen there is a gear icon.
    • For a file this is with the file name
    • For an image this is in the top-right corner of the image preview
  • From this menu choose "Replace the file"
  • Upload your new file
Here's the screenshot for a replacing a regular file.From the gear icon on the right choose Replace the file

And, here's the screenshot for replacing an image file.
Images have the gear icon in the top corder of the preview image

Benefits of this Approach

In addition to helping keep your libraries clean and organized, this approach of replacing an existing file will do two helpful things for you:

  1. Any links on your site to the file don't need to be changed.  Those existing links will now open the newest version of the file.
  2. The other existing properties and file name on your website are kept clean. When you replace a file, Sitefinity keeps the original file name. If you replace "myfile.pdf" with one from your computer named "myfile-v2-draft-final-final.pdf", Sitefinity sticks with "myfile.pdf"
Back to Top Arrow Up