i have a file explorer like below :
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SearchBar.aspx.cs" Inherits="FileExplorer.SearchBar" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script type="text/javascript">
// function OnClientFileOpen(oExplorer, args) {
// args.set_cancel(true);
// radopen(args.get_item().get_url());
// }
function OnClientFileOpen(oExplorer, args) {
var item = args.get_item();
var fileExtension = item.get_extension();
var fileDownloadMode = document.getElementById("chkbxDownoaldFile").checked;
if ((fileDownloadMode == true) && (fileExtension == "jpg" || fileExtension == "gif")) {// 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;
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<telerik:RadWindowManager ID="RadWindowManager1" runat="server">
</telerik:RadWindowManager>
<telerik:RadFileExplorer runat="server" ID="RadFileExplorer1" Height="400px" Hidth="600px"
EnableCreateNewFolder="false" EnableCopy="true" OnClientFileOpen="OnClientFileOpen" enableopenfile="true">
<Configuration ViewPaths="~/Files" UploadPaths="~/Files" DeletePaths="~/Files" />
</telerik:RadFileExplorer>
<br />
<asp:CheckBox ID="chkbxDownoaldFile" runat="server" Text="Open images for direct download " />
</div>
</form>
</body>
</html>
the upper codes are just an example and you can see their demo in the below link …
FileExplorer / Filter files and download
i want to allow my users to download any file from my server without any preview (just save as window)…
so for this purpose i can change the upper codes easily.
but there is a situation here -> i want to capture and filter downloads (file size limit) (sql server 2008 database).
it seems RadFileExplorer only has client side events for my purpose!
when my page loads , i want to show RadFileExplorer to my user for just seeing it’s files without any permission for download.
when he/she double clicks on a file i tell that user plz login first!
after his/her logined , he/she can download files but only 1 GB per day.
how can i do this stuff for my RadFileExplorer ?
is web service and web methodes a good idea for this situation?
thanks in advance
The code you are using relies on a handler – “Handler.ashx”. All files are streamed using this handler so you can implement your server side restrictions in its code. I think you can also use the handler to redirect the browser to a different page if the user is not logged in.