This is a migrated thread and some comments may be shown as answers.

Existing files displayed despite being deleted

1 Answer 39 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 07 Jul 2015, 03:58 PM

Hello everyone

Hopefully I am being stupid but I have the following problem with the rad file explorer. I've set it so a user can upload and delete files. If Istart with a blank cancas, i.e. nothing present in any existing folders and add/delete files, absolutely no problem at all (see Working.gif)

However, if I already have an existing file present in my file path, I experience a bit of nasty stuff (see NotWorking.gif) - as you can see, the file appears to be present, it isn't, it has been removed from the filepath as requested hence you see the 'resource not found' error when I attempt to open it.

Here is the code I have.

Markup

 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager>
        <script type="text/javascript">
            (function (global, undefined) {
                function OnClientFileOpen(oExplorer, args) {
                    var item = args.get_item();
                    var fileExtension = item.get_extension();
 
                    var fileDownloadMode = true;
                    if ((fileDownloadMode == true) && (fileExtension == "txt" || fileExtension == "xls" || fileExtension == "xlsx")) {// Download the file
                        // File is a image document, do not open a new window
                        args.set_cancel(true);
 
                        // Tell browser to open file directly
                        var requestImage = "Handler.ashx?path=" + item.get_url();
                        document.location = requestImage;
                    }
                }
 
            global.OnClientFileOpen = OnClientFileOpen;
        })(window);
        </script>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="Configuratorpanel1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadFileExplorer1" LoadingPanelID="theLoadingPanel" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <div>
 
 
            <telerik:RadFileExplorer runat="server" ID="RadFileExplorer1" Width="595px" Height="320px"
                OnClientFileOpen="OnClientFileOpen" EnableOpenFile="true">
                <Configuration MaxUploadFileSize="51200000"></Configuration>
            </telerik:RadFileExplorer>
 
 
        </div>
    </form>
</body>
</html>

C#

 

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
 
public partial class Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //set properties according to configuration panel
        RadFileExplorer1.Configuration.SearchPatterns = new string[] { "*.jpg", "*.jpeg", "*.gif", "*.png", "*.txt", "*.xls", "*.xlsx" };
        RadFileExplorer1.VisibleControls = GetVisibleControls();
 
        //Set initial folder to open. Note that the path is case sensitive!
        //var filePath = "~/TestData";
        var filePath = "~/TestData/6645dc9a-5e8c-46e9-aad0-ba9b087aae4a";
        //var filePath = "~/TestData/a4089fd8-3170-4956-a8f5-1ea21a19d984";
 
        RadFileExplorer1.Configuration.UploadPaths = new string[] { filePath };
        RadFileExplorer1.Configuration.ViewPaths = new string[] { filePath };
        RadFileExplorer1.Configuration.DeletePaths = new string[] { filePath };
 
        if (!IsPostBack)
        {
            //Set initial folder to open. Note that the path is case sensitive!
            RadFileExplorer1.InitialPath = Page.ResolveUrl(filePath);
        }
 
    }
    protected Telerik.Web.UI.FileExplorer.FileExplorerControls GetVisibleControls()
    {
        Telerik.Web.UI.FileExplorer.FileExplorerControls explorerControls = 0;
        explorerControls |= Telerik.Web.UI.FileExplorer.FileExplorerControls.All;
        return explorerControls;
 
    }
}

If anyone can point out what I am doing wrong or what else I may need to implement, I'd be most grateful.

Rich

 

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 09 Jul 2015, 08:53 AM
Hi Richard,

I have already answered your support ticket on the subject, for convenience I am pasting my answer here as well:

Thank you for reporting this issue to us. We are aware of this reggression behavior and it is already fixed in our latest hot fix, which can be downloaded for testing from your Telerik account. The fix will be officially released in out up-coming service pack (2015 Q2 SP1), scheduled for the end of July.

Unfortunately I am not able to provide any workaround for the moment. Please, excuse us for the caused inconveniences.


Regards,
Vessy
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
FileExplorer
Asked by
Richard
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Share this question
or