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

http://demos.telerik.com/aspnet-ajax/fileexplorer/examples/overview/defaultcs.aspx

       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
ADMIN
Rumen
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>
        <span class=""rfeThumbTitle"">#= Name #</span>
    </a>
</li>";

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" />
</telerik:RadFileExplorer>
<script>
    function onFileOpen(explorer, args) {
        var newUrl = args.get_path() + "?" + Math.random();
        args.get_item().set_url(newUrl);
    }
</script>

Hope this helps.