MimeType Checking

4 posts, 1 answers
  1. Anthony
    Anthony avatar
    14 posts
    Member since:
    Apr 2009

    Posted 22 Oct 2009 Link to this post

    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?
  2. Answer
    Fiko avatar
    1406 posts

    Posted 28 Oct 2009 Link to this post

    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,
    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.
  3. Ram Adduri
    Ram Adduri avatar
    2 posts
    Member since:
    Mar 2010

    Posted 27 Mar 2010 Link to this post

    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.

  4. Dobromir
    Dobromir avatar
    1633 posts

    Posted 31 Mar 2010 Link to this post

    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="~/" />
    <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());
                alert("The selected item is a folder");
            //cancles the event

    I hope this helps.

    Sincerely yours,
    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.
Back to Top