10

I have found an odd behavior of an uploading images into media library. Depends on a browser, I can select multiple files at the time or not. For example:

It doesn't work in Chrome and in Firefox:

Chrome and Firefox - Multiple select is not available

It works fine in Opera:

Opera - Multiple select is available

But it works fine in the Chrome browser on the machine of my colleague.

I thought that the reason is in Adobe Flash which isn't probably installed in my Chrome and is installed for Chrome of my colleague, but not, it isn't installed for both.

Maybe someone knows a reason of this behavior? I need to explain client why he can't select multiple files, but I don't have any idea and I can't recommend him to use Opera browser :).

  • yes is a adobe flash problem, to avoid this problem I remember you have to set Upload.Classic setting to true. Can you give a try ? – Vlad Iobagiu Jun 16 '17 at 14:49
  • I guess if I set the Upload.Classic setting to true, the single file selection will always be shown. Or am I wrong? – Artsem Prashkovich Jun 16 '17 at 14:51
  • @SitecoreClimber I tried and I was right. When I set true for Upload.Classic, I am always able to select just one file at the time. But on the contrary I need to have the opportunity to select several. – Artsem Prashkovich Jun 16 '17 at 14:59
  • can you try on incogntito mode where you don't have extensions on your browser, do you have antivirus and your colleague not? – Vlad Iobagiu Jun 16 '17 at 15:00
  • @SitecoreClimber We both don't have an antivirus. When I open sitecore in the incognito mode, the multiple file upload is available. Very strange. – Artsem Prashkovich Jun 16 '17 at 15:04
9

I saw this behavior when you have a firewall, antivirus or cookies are corrupted. Somehow
Please try to delete all your cookies and try again.

Cookie with key : sc_fv contains Flash Version and probably somehow this one was corrupted.
On the method Sitecore.Shell.Framework.Commands.Media.MultiUpload.QueryState(CommandContext context) is verifying method UseFlashUpload

This method verify if your Sitecore Client SupportFlashUpload:

public virtual bool SupportsFlashUpload
{
    get
    {
        return this.GetFlashVersion().Major >= 9;
    }
}

on the method GetFlashVersion it reads sc_fv cookie value:

    protected virtual Version GetFlashVersion()
    {
    string cookieValue = WebUtil.GetCookieValue("sc_fv");
    if (string.IsNullOrEmpty(cookieValue))
    {
        return new Version(0, 0, 0);
    }
    string[] array = cookieValue.Split(new char[]
    {
        '.'
    });
    if (array.Length != 3)
    {
        Log.Error("Unexpected flash version cookie value: " + cookieValue, this);
        return new Version(0, 0, 0);
    }
    int @int = MainUtil.GetInt(array[0], 0);
    int int2 = MainUtil.GetInt(array[1], 0);
    int int3 = MainUtil.GetInt(array[2], 0);
    return new Version(@int, int2, int3);
 }
  • Thanks a lot for your answer and explanation! You really saved my time. Grate job! 👍 – Artsem Prashkovich Jun 16 '17 at 15:50
  • Welcome, anytime. – Vlad Iobagiu Jun 16 '17 at 15:51
  • Digging into how the uploader works (in 8.1 at least) it uses yui uploader which uses HTML5+XMLHttpRequest 2 or Flash as a fallback so if you don't have flash installed then it should work in most browsers: yuilibrary.com/yui/docs/uploader – Adam Seabridge Jul 26 '17 at 14:01
  • oh friends.. there's opportunity here. HTML5 File API replaces flash as the uploader of choice. Flash does cover older browsers that won't handle HTML5 (which are few honestly). Hmm.. I guess I'd have to know telerik better to make good use myself – Josh Robinson Nov 15 '17 at 16:51
  • I manually updated the cookie value to 9.0.0 and it started working. – Mrunal Brahmbhatt Jul 9 '19 at 23:22
3

To add to this, Flash is indeed the culprit. If you're looking for something a little more perm. support recommends the following:

For the 'Upload File' dialog:

  1. Navigate to \Website\sitecore\shell\Applications\Media\Upload Media\
  2. Open the UploadMedia.xml file
  3. On line 27, add the attribute multiple="true" to the <input id="File" ... /> tag:
    <input id="File" name="File" type="file" style="width:100%" multiple="true"/>

For the "Upload files (advanced)" dialog:

  1. Navigate to the \Website\sitecore\shell\Applications\Media\UploadManager folder
  2. Open Upload.aspx
  3. Find the <input id="File0" name="File0" .../> tag inside the file and add the multiple="true" attribute:
    <input multiple="true" id="File0" name="File0" type="file" value="browse" onchange="javascript:return Sitecore.Upload.change(this)"/>
  4. Open the Upload.aspx.js file
  5. Search for ctl.type = "file"; line and put a new line after it:
    ctl.multiple = true;

Please note that this workaround has not passed full QA cycle. In case of any issue with upload please revert the changes.

0

The problem stems from the cookie sc_fv resetting to the value of 0.0.0 upon browser restart. The best workaround I found was using a browser extension such as edit this cookie to lock the value of the cookie to 31.0.0

Edit This Cookie sc_fv

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.