In this article, I’m going to show the error that I have faced in my project.
Problem:
When I upload and try to upload an existing image in a media library it does
not show only an empty error screen without any error message.
Experience Editor
Content Editor:
Image names
in each media folder should be unique. If we try to upload the same file with the same folder Sitecore will return “the file does not exist or the path is
wrong” in a content editor.
In Browser
console shows below error information
Error message:
Message: ReferenceError: text is not defined;
Bindings value: text: text, attr: { title: text }
at ko.bindingProvider.parseBindingsString (knockout-2.2.1.js:1936:23)
at ko.bindingProvider.getBindings (knockout-2.2.1.js:1916:64)
at result.getBindings (sitecore-1.0.2.js:147:55)
at ko.dependentObservable.disposeWhenNodeIsRemoved (knockout-2.2.1.js:2067:100)
at evaluateImmediate (knockout-2.2.1.js:1241:41)
at ko.dependentObservable (knockout-2.2.1.js:1318:9)
at applyBindingsToNodeInternal (knockout-2.2.1.js:2051:12)
at applyBindingsToNodeAndDescendantsInternal (knockout-2.2.1.js:2019:37)
at applyBindingsToDescendantsInternal (knockout-2.2.1.js:2001:13)
at applyBindingsToNodeAndDescendantsInternal (knockout-2.2.1.js:2028:13)
Sitecore Log File
24160
16:44:01 ERROR Could not save posted file: 5.jpg
Exception: Sitecore.Exceptions.DuplicateItemNameException
Message: The item name "5" is already defined on this level.
Source: Sitecore.Kernel
at Sitecore.Data.Items.ItemUtil.AssertDuplicateItemName(Item destinationItem, Item sourceItem, String name)
at Sitecore.Data.Items.ItemUtil.AssertItemName(Item destinationItem, Item sourceItem, String name)
at Sitecore.Data.Items.Item.Add(String name, TemplateID templateID)
at Sitecore.Resources.Media.MediaCreator.CreateItem(String itemPath, String filePath, MediaCreatorOptions options)
at Sitecore.Resources.Media.MediaCreator.AttachStreamToMediaItem(Stream stream, String itemPath, String fileName, MediaCreatorOptions options)
at Sitecore.Resources.Media.MediaCreator.CreateFromStream(Stream stream, String filePath, MediaCreatorOptions options)
at Sitecore.Resources.Media.MediaUploader.UploadToDatabase(List`1 list)
at Sitecore.Resources.Media.MediaUploader.Upload()
at Sitecore.Pipelines.Upload.Save.Process(UploadArgs args)
Solution:
We can allow
the duplicate name in the same folder using the patch config file
Steps to
create a patch file:
1. Create a new config file with the
name of AllowDuplicateItemNamesOnSameLevel.config
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<settings>
<setting name="AllowDuplicateItemNamesOnSameLevel">
<patch:attribute name="value">true</patch:attribute>
</setting>
</settings>
</sitecore>
</configuration>
Save the file in App_config/Include folder.
keep learning!!!
0 Comments
Post a Comment