Uploading an image via Image field returns broken in SC version 8.1 Initial release and 8.1 Update-1 [short-term & long-term fix]

Posted on Updated on

Last week, I was tapped to troubleshoot a production issue related to image upload via Image field (logo field) of a header item.

The client reported that when they upload an image that has ‘-‘ and spaces around it (eg. main – logo.jpeg), it throws a broken image when viewed in the image upload dialog box.

Figure 1 : Browse a media file

Sitecore Upload an image via Image upload dialog box

Figure 2 : Uploaded

Sitecore image uploaded returns broken image

Figure 3 : Looking at the browser console log, it returned a 404 (not found) error.

Sitecore image uploaded returns 404 in the browser console log.JPG

Figure 4 : Opening the link returns ‘A request document was not found’

Sitecore - Opening an image that has 3 dashes returned an error 404 not found

I really wanted to help, so I made an investigation across all Sitecore platform versions (8.X) to simply check if this was an existing bug and if has a fix already. I also considered checking the latest version of Sitecore (as of this writing, v.8.1-U2) before jumping to a conclusion that it is probably because of a wrong configuration file / DLL or a customization.

I jotted down the result of each of the platform versions, to easily compare where and what version of Sitecore it could be encountered. I used a freshly installed instances for the purpose of my testing.

Platform version, image upload testing result:

  1. 8.0 Update-3 : Working via Media Library & image upload
  2. 8.0 Update-4 : Working via Media Library & image upload
  3. 8.1 Initial release : (current version of the client): NOT working via image upload, but working via Media Library. 
  4. 8.1 Update-1 : NOT working via image upload, but working via Media Library.
  5. 8.1 Update-2 : Working via Media Library & image upload

In a high level explanation:

Say, we have this image file (eg. main – logo.png), when a content user uploads it to Sitecore, the mechanism behind the parsing of this file will be treated like this : mainlogo.jpeg. And therefore,  the error 404 not found was encountered in the browser console log which turns to a broken image upon viewing in the image upload dialog box. Surprisingly, when a client user uploaded an image via Sitecore > Media Library, the image displayed properly. Strange, isn’t it?

In a detailed explanation:

    1. When you upload an image (eg. main – logo.jpeg) via image upload in Sitecore v.8.0 Update-3 and v.8.0 Update-4, it was uploaded properly without any issue.
    2. When you upload an image (eg. main – logo.jpeg) in v.8.1 Initial release (In my case, this is the current version of the client instance) and in v.8.1 Update-1, Sitecore introduces a new – line 1844 in the figure below

      Node under the:


      That causes the problem. After removing the node <replace>, and test again, the image upload works as expected.

    3. When you upload an image (eg. main – logo.jpeg) via image upload in Sitecore v.8.1 Update-2, you will experience the same working behavior just like the #1 (in v.8.0 Update-3 and v.8.0 Update-4).
      • Looking at the web.config file, the dash ‘-‘ replace node is still exists.
      • And it is still working.

By this time, I suspected that it has something to do with the binaries. So what I did, is to play around with Sitecore.Kernel by replacing the Sitecore.Kernel version of v.8.1 Initial release to v.8. Update 2. I tested it again and it works!

By replacing the Sitecore.Kernel.dll, it fixed the issue without altering any configuration on the freshly installed instances.

I raised my findings to our solution architect by providing a short-term and a long-term fix.

Short-term fix:

Since my personal take is to provide an immediate remedy, considering that the client content users are consistently uploading image and should not be interrupted. So my short-term proposal is to inform the client that every time they upload an image:

  1. They can use the Media library and referenced the image (eg. main – logo.jpeg) to ITEM ABC (eg. header item)
  2. They can use image upload dialog box > upload media file BUT with caution. During the upload, the client content users are forced to change the name of the image if has dash(es) and remove the spaces before and after those dash(es).


Sitecore Upload an image via Image upload dialog box - cropped


Sitecore upload an image via Image upload dialog box with no spaces on and before the dash
Removed the spaces


Long-term fix:

  1. Explore upgrading the Client instance to v.8.1 Update-2
  2. Raise to Sitecore, so they can provide a patch on this.  (In progress)
    • I doubled check the known issues page in v.8.1 Initial release up to v.8.1 Update-2, but it seems that this was not yet reported
  3. Dissect the Sitecore.Kernel and provide a custom patch, by checking the assembly and override the mechanism relative to the encodeNameReplacement specific


Troubleshooting summary:

  1. Connect with the client
  2. Test client production instance
  3. Test in all platform versions (freshly installed)
    1. via Media Library
    2. via Image upload dialog box
  4. Check release notes and know issues of 8.X
  5. Override the Sitecore.Kernel.dll with the latest version  (v.8.1 Update-2)
  6. Provide a proposals
    1. Short-term fix
    2. Long-term fix

Happy Sitecoring day, everyone!


  1. Sample logo image: http://www.logomyway.com/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s