Missing images - records are in media_file table and files are in folder

Joseph Huddleston asked on April 5, 2019 16:10

I have a setup where I develop on my PC but share my database with a remote Kentico install.

This usually works with one stipulation being that media files and other attachments should be uploaded on the remote cms then the files synchronized (read one-way copy) back to my machine.

I have a problem, now, where that copy back to my local has been completed, the files are in my local folders, the records are in the media_file table, but the images never appear anywhere they are used.

More confusingly is when I go to the media library on my local machine the files are not listed. However, they are listed in the remote media library. I did attempt to upload them from my machine just to see what happens and i get an "already exists" error, which i expected.

I know my machine and the remote server are sharing the same database because my local changes to the data are reflected remotely.

How do I fix this?

Correct Answer

Roman Hutnyk answered on April 5, 2019 17:29

Record about media library file exist in database, so every instance should know about it. In your case local instance probably haven't listed them because of caching - try to clear a cache and they should appear in your local instance.

However actual file is being stored into a file system of the machine that is running an instance and other instances will never open that file as it simply does not exists in their file system.

You could use shared storage, sync them manually or setup some script that will automatically a job for you.

0 votesVote for this answer Unmark Correct answer

Recent Answers

Rui Wang answered on April 5, 2019 17:27

You are basically using the web farm setup (2 IIS pointing to 1 database) but likely without the the 2 servers web farm license. So the file sync between the 2 web servers doesn't happen automatically.

So when you add some files to media library through the server URL, then the file reference will be in the database, but the physically file would only on the server \CMS\yoursitename\media... Without auto web farm sync, you will need to manually copy all files from that path from your server to local in order for those images to show up.

0 votesVote for this answer Mark as a Correct answer

Joseph Huddleston answered on April 8, 2019 15:56 (last edited on April 8, 2019 16:23)

I discovered the problem was our program to sync the folder was syncing the wrong location. We just finished an upgrade to v12 and that profile got over looked.

That being said, I am going to investigate using the shared folder.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.