简体   繁体   English

在 Sitecore 媒体库中上传图片时出错

[英]An error occurred while uploading the image in Sitecore Media Library

I want to manually upload an image into specific folder in the Sitecore Media Library.我想手动将图像上传到 Sitecore 媒体库中的特定文件夹。

While uploading the image I am getting an error saying An error occurred while uploading a file.上传图片时出现错误,提示上传文件时发生错误。 The reason may be the that the file does not exist or the path is wrong .原因可能是文件不存在或路径错误

Please see the screenshot below:请看下面的截图: 在此处输入图像描述

I have tried to change some configuration settings in the Sitecore.Speak.Applications.config file but still having the same issue.我试图更改Sitecore.Speak.Applications.config文件中的一些配置设置,但仍然遇到同样的问题。

Please advise what can be causing this error.请告知可能导致此错误的原因。

I saw a similar error in the past and in my case it was caused by a duplicate item name in the Media Library folder.我过去看到过类似的错误,在我的例子中,这是由媒体库文件夹中的项目名称重复引起的。

Image names in each media folder should be unique.每个媒体文件夹中的图像名称应该是唯一的。 If you try to upload a file with the name that already exists in the selected folder, Sitecore will return the message saying " the file does not exist or the path is wrong ".如果您尝试上传所选文件夹中已存在名称的文件,Sitecore 将返回消息“文件不存在或路径错误”。 If this is the problem, you will see the error Sitecore.Exceptions.DuplicateItemNameException in Sitecore log file:如果这是问题所在,您将在 Sitecore 日志文件中看到错误Sitecore.Exceptions.DuplicateItemNameException

35220 12:30:19 ERROR Could not save posted file: test.png
Exception: Sitecore.Exceptions.DuplicateItemNameException
Message: The item name "test" 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)

UPDATE:更新:

I double checked when this error message is used, and it can be caused by any exception thrown during media item creation.我仔细检查了何时使用此错误消息,它可能是由媒体项目创建期间抛出的任何异常引起的。 Some exceptions are thrown during item name validation: for example, if file name is too long (setting MaxItemNameLength ), name ends with .在项目名称验证期间抛出一些异常:例如,如果文件名太长(设置MaxItemNameLength ),名称以. , name starts or ends with spaces or tabs, name contains invalid characters (setting InvalidItemNameChars ) or name does not match pattern from the setting ItemNameValidation . ,名称以空格或制表符开头或结尾,名称包含无效字符(设置InvalidItemNameChars )或名称与设置ItemNameValidation中的模式不匹配。

So you can try uploading another file or renaming your file to a simple file name containing only letters and see if it helps.因此,您可以尝试上传另一个文件或将文件重命名为仅包含字母的简单文件名,看看是否有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM