Replace files in the Media Library


Read time: 6 minutes

The Media Library stores files used on your website, such as images and PDFs. When a file needs to be updated, replace the existing item in the Media Library. This ensures the latest version appears everywhere it’s already linked and prevents broken links. All item details - such as title, teaser, and URL - stay the same.

Looking to replace multiple files at once? Skip to Replace multiple files using a batch upload below for a faster method when updating several files with the same file names.

Replace a Single File

  1. Click the Media Library icon.
    Screenshot of media library button/icon on the Sitecore home dashboard
  2. Navigate to the folder where the current file is stored.
  3. Click the file to open its properties.
  4. If a yellow message bar appears, select Lock and Edit.
  5. Scroll to the Media section and select Detach.

    Media Library - Media Section
  6. A confirmation dialog appears - click OK.

  7. Attach the file.
    • In the popup window, click Choose File to browse for the updated file.


    • Select Attach to upload it.
  8. Select the Save  icon. The file has now been updated. All pages linking to this media item will automatically display the updated version once it’s published, and all existing item properties, including the title, metadata and item information remain unchanged.
    Note: The URL stays the same when you replace a file. It only changes if you choose to rename the media item. For example, to make the URL cleaner or more descriptive.
  9. Publish the media item. To make the new version visible on the live website, publish the media item. If you do not have publishing privileges you must reach out to your designated Sitecore Admin and have them publish the updated media item.
  10. Be sure to check the item back in. Click the Edit  icon in the Home tab and select  Check In. This unlocks the media item for other editors.
    Screenshot of the Check In option in the Edit icon dropdown on the Home tab.

 

Replace multiple files using a batch upload

Use a batch upload when you need to replace multiple files at once. This method works when the replacement files have the exact same file names as the existing media items. Sitecore will overwrite the existing files while preserving the media item, URL, and existing links.

Important: Files must be uploaded to the same Media Library folder where the existing files are stored, and the replacement files must have the same names as the originals.

  1. Navigate to the correct Media Library folder
    Open the Media Library and select the folder that contains the files you want to replace.
  2. Select Upload files (advanced)
    From the folder, choose Upload files (advanced). screenshot of upload files advanced button shown
  3. Choose the replacement files
    Select Choose File and browse to the updated files on your computer.You can add multiple files before uploading. After selecting a file, choose Choose File again to add another. Continue until all replacement files have been added.Screenshot of Batch Upload dialogue box to show Choose file button with Overwrite existing media items box checked
  4. Select Overwrite existing media items
    Check the Overwrite existing media items option. This replaces files that already exist in the selected folder instead of creating duplicate media items.
  5. Upload the files
    Select Upload. Sitecore will replace any existing files that have matching names.
  6. Save your changes
    Select the Save icon at the top left of the screen.
  7. Publish the updated files
    To make the replacement files visible on the live website, publish the parent folder containing the updated files. Publishing the folder publishes all updated files within it at once, eliminating the need to publish each file individually.

 

Media Library