Kentico 12 MVC export/import media library issue

S T asked on January 24, 2024 13:06

Hi, I've exported 200 logos from one site to another(media files not physical). On the other site I did the import and copied the physical files manually to the correct media library folder. Most of them were fine except maybe 40 of them that had a space in the name have to be imported (they have the yellow warning sign) but here is the interesting part. When I click on the import sign I get the standard "Media file record doesn't exist in database. You can import the file by filling out the following form:" and after clicking Import I get an error message below the file name field saying "The media file with path 'Something-With-Space.png' already exists in the database. Copy the file to the file system manually or delete the file from the database and perform the upload again." and if I do nothing and just refresh the page, that image in the media library is OK. I can't import the remaining ones by selecting them all because for every image I get the same mentioned above and I dont want to click thru each one. Is there a solution for this ?

Regards

Recent Answers


Brenden Kehren answered on January 24, 2024 15:45

In your original site, did you have the files stored in the database and the file system or just one or the other?

What's happening is:

  • you exported just the media file database records and not the physical files
  • on your import you checked to import the physical files, however, during your export you never exported any
  • you manually copied files from one server to another
  • your new database (site you imported to), has a database record but no phyical file OR there is a physical file but no database record.
  • OR worse yet, a ghost database record which will cause a collision when you try to import that file with the same name.

My suggestion would be:

  1. delete all those logos from Kentico using the Media Library UI.
  2. Delete any physical files from the file system from that logo folder
  3. Query the Media_File database table looking for a library ID and/or a folder path that matches the location of the logos. Something like select * from media_file where filepath like 'logos/%
  4. Review any of those records and manually delete any necessary from the database.
  5. Export the media library files again AND the physical files.
  6. Import the media library files and the physical files.

The other option is to do the following:

  1. Manually copy the files from one location to the other
  2. In the Media library, perform a mass import
  3. You can mass import by selecting all the files necessary to import,
  4. Click the Import button,
  5. Check the box to use the same description for all
  6. Uncheck the box to show a preview

This will import all the images in a short amount of time to the database.

0 votesVote for this answer Mark as a Correct answer

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