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

MimeType Checking

3 Answers 205 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Anthony
Top achievements
Rank 1
Anthony asked on 22 Oct 2009, 06:52 PM
I see that the file explorer allows files to be checked by their file extension. Is it possible to check files based on mime type?

3 Answers, 1 is accepted

Sort by
0
Accepted
Fiko
Telerik team
answered on 28 Oct 2009, 08:05 AM
Hello Anthony,

Yes, you need to set a custom FileBrowserContentProvider and override the StoreFile method. In this method you can get the MIME type of the uploaded file. For your convenience I have attached a demo showing how this can be implemented.

I hope this helps.

Kind regards,
Fiko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ram Adduri
Top achievements
Rank 1
answered on 27 Mar 2010, 03:07 PM
I saw your demo application. its nice and working fine but only problem is it should show a message once he tried to upload file. is there any way to show that message also one more help i need that is there any way that i need to open olny specified extension files.

Thansk,
Ram
0
Dobromir
Telerik team
answered on 31 Mar 2010, 06:28 PM
Hi Ram,

In order to pop-up a message from the code behind you need to register client script to the page using the approach given in the following KB article:
Calling radalert from codebehind (all versions of RadWindow)

Regarding the opened files, RadFileExplorer fires a client event OnClientFileOpen and you can use the following approach to check the file extension:
<telerik:RadFileExplorer ID="RadFileExplorer1" runat="server" OnClientFileOpen="OnClientFileOpen" EnableOpenFile="true">
    <Configuration ViewPaths="~/" />
</telerik:RadFileExplorer>
 
<script type="text/javascript">
    function OnClientFileOpen(sender, args)
    {
        var item = args.get_item();
 
        if (item.get_extension())
            alert("The selected item's extension is: " + item.get_extension());
        else
            alert("The selected item is a folder");
 
        //cancles the event
        args.set_cancel(true);
 
    }
</script>

I hope this helps.

Sincerely yours,
Dobromir
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
Tags
FileExplorer
Asked by
Anthony
Top achievements
Rank 1
Answers by
Fiko
Telerik team
Ram Adduri
Top achievements
Rank 1
Dobromir
Telerik team
Share this question
or