Last Updated: 21 Jun 2022 10:05 by ADMIN
Created on: 26 Jun 2015 14:55
Category: FileExplorer
Type: Feature Request
Image is cashed after deletion
Steps to reproduce:

       1.  Delete Flower3.jpg
       2.  Rename Flower5 to Flower3

Actual: The image with Flower3 name has changed to the one which was deleted
1 comment
Posted on: 21 Jun 2022 10:05
A possible way to force the browser to delete the cached images is to add a cache bustlering string to the thumbnails url's. You can achieve that by modifying the client template used for the Listview items (the FileExplorer's thumbnails) in a similar way:
RadFileExplorer1.FileList.ListView.ClientSettings.DataBinding.ItemTemplate =
        @"<li class=""rfeThumbList rlvI"">
    <a href=""javascript: void 0;"" class=""rfeLink rlvDrag#= isSelected ? ' rfeSelectedLink' ''#"" data-index=""#= index #"" title=""#= Name #"">
        <span class=""rfeFile#= Telerik.Web.UI.FileExplorerHelper.isWebImage(item.Extension) ? ' rfeImageFile' '' #"">
        # if(Telerik.Web.UI.FileExplorerHelper.isWebImage(item.Extension)) {#
            <img src=""#= item.Url || Path#?#=Math.random()# "" alt=""#= Name #"" width=""32"" height=""32"" />
        # } else { #
            <span class=""rfeFileIcon #= Telerik.Web.UI.FileExplorerHelper.getThumbnailCSSExtension(item) #""></span>
        # } #
        <span class=""rfeThumbTitle"">#= Name #</span>

Please note, that the thumbnails are not the only images which are cached by the browser and you will most probably experience the same behavior when trying to open an image having the same name as an already cached one. This behavior can be workarounded by handling the FileExplorer's ClientFileOpen event like follows:
<telerik:RadFileExplorer ID="RadFileExplorer1" runat="server" ExplorerMode="Thumbnails" OnClientFileOpen="onFileOpen">
    <Configuration ViewPaths="~/images/Test" UploadPaths="~/images/Test" DeletePaths="~/images/Test" />
    function onFileOpen(explorer, args) {
        var newUrl = args.get_path() + "?" + Math.random();

Hope this helps.