When you upload a file to ImageKit, a random string gets added at the end of the file's name. This is done to prevent accidental overwrite if you are uploading an image with a filename that already exists in the media library.
However, if you are sure that you want to overwrite any pre-existing image from the media library, you can turn this default feature off.
Steps to disable random string being appended to uploaded file names
1. Go to the "Image Settings" menu from your ImageKit dashboard.
2. Select the "MEDIA LIBRARY" tab in this section.
3. Disable the setting "ENSURE UNIQUE IMAGE NAMES DURING UPLOAD".
4. Click on "Save" to save this change in setting.
5. After the changes have been saved successfully, any file that you upload to the media library, will not have a random string appended at the end of the file name. You can revert this setting at any point in time without impacting your pre-existing images.
The video below shows how you can disable this setting from your ImageKit dashboard.
If you are using the Upload API to upload files to the Media Library, then you'll have to set the value of useUniqueFileName
as false
.