Problem/Motivation

The first time I replace a file, this works. When I try to replace the file again with a new file, nothing happens. I've tried clearing the cache then replacing the file but it still won't work.

Any tips or suggestions would be greatly appreciated.

Steps to reproduce

1. Replace an existing file on a media entity.
2. Replace the file again on the same media entity with a different file

Comments

campbellt_ created an issue. See original summary.

campbellt_’s picture

Title: Replace an already replaced file not working » Replacing an already replaced file isn't working
bkosborne’s picture

  1. Are you saving the form between replacements? Like you are completing the first replacement entirely, then you go back and edit the document a 2nd time, and the replacement does not work then?
  2. Are you using the checkbox to replace original file both times?

I just tried this and I could not reproduce it.

Note that your browser or CDN may be caching the original file. Perform a hard refresh or disable caching in your browser to confirm.

anybody’s picture

Status: Active » Postponed (maintainer needs more info)
drurian’s picture

I'm having the same issue on the Acquia servers but not locally. I have to manually delete files to make it work.

Note: this seems to be happening only if Overwrite original file option is checked. However, with this option unchecked, if the replacement file has the same name as the old file, Drupal adds a number to its name and the old file still exists.

wylbur’s picture

We ran into this issue during testing. We checked the server file directory, and the file was updated, but the old file was cached within the browser cache.

With so many levels of powerful caching, this can really be tricky!

The module does provide messages about the created file, so this is working.

usmanjutt84’s picture

Hi, I can confirm #6 by Wylbur. I updated a file with the "Overwrite original file" check enabled and it didn't work on the spot while it started working after couple of minutes.

bkosborne’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

This is a caching problem. Check out the project overview page which has lots of details about the cache issue.