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

File Manager

4 Answers 470 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Matthew R.
Top achievements
Rank 1
Matthew R. asked on 06 Feb 2014, 08:06 PM
I wanted to know if there is a way to leverage the
directory browser used as part of the editor widget as a stand-alone feature to
use as a file manager through the UI. I’d like to use it to access a directory
(and series of subfolders) as part of an application that I’m building for
administrative access to files uploaded by users to be used as templates for a
service.

4 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 10 Feb 2014, 01:31 PM
Hello Matthew,

Using the ImageBrowser as a standalone file manager is possible, although not officially supported or documented. It can be configured in exactly the same way, as when it is part of the Editor widget. Note that you must use a Javascript configuration, as a server wrapper is not available.

http://docs.kendoui.com/api/web/editor#configuration-imageBrowser

http://docs.kendoui.com/getting-started/web/editor/imagebrowser

http://demos.kendoui.com/web/editor/imagebrowser.html


<div id="ImageBrowserDiv"></div>


$("#ImageBrowserDiv").kendoImageBrowser({
    fileTypes: "*.gif,*.jpg",
    transport: {
        read: "/service/ImageBrowser/Read",
        destroy: {
            url: "/service/ImageBrowser/Destroy",
            type: "POST"
        },
        create: {
            url: "/service/ImageBrowser/Create",
            type: "POST"
        },
        thumbnailUrl: "/service/ImageBrowser/Thumbnail",
        uploadUrl: "/service/ImageBrowser/Upload",
        imageUrl: "/service/ImageBrowser/Image?path={0}"
    }
});

The ImageBrowser exposes the following events:

change - triggered when the user selects (clicks on) an image thumbnail
apply - triggered when the user confirms (double-clicks on) an image thumbnail
error - triggered when a read or upload ajax request fails

These events are primarily intended for internal use, but you can add handlers too, using bind():

http://docs.telerik.com/kendo-ui/getting-started/widgets#example---subscribe-to-an-event-using-the-bind-method

As the ImageBrowser has been designed to work with images, it expects to show a thumbnail for each file and will make a request for such a thumbnail. You need to decide how to handle those.

Renaming is not supported.

Finally, you should keep in mind that the ImageBrowser only allows an explicitly defined list of file types to be uploaded (using a *.* wildcard is not possible). In case you want to remove this requirement, you need to modify the widget source code.

_fileUpload: function(e) {
// ...
        filterRegExp = new RegExp(("(" + fileTypes.split(",").join(")|(") + ")").replace(/\*\./g , ".*."), "i"),
// ...
 
    if (filterRegExp.test(fileName)) {
        e.data = { path: that.path() };
// ...
},


Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Carl
Top achievements
Rank 1
answered on 25 Jun 2016, 01:20 AM

Are the recommendations above in this thread still current?

Is there any file manager browser control available in UI for ASP.NET MVC?

I'd like to use something that will work well with the file upload control in UI for ASP.NET MVC.

0
Matthew R.
Top achievements
Rank 1
answered on 26 Jun 2016, 02:59 PM
While I'm sure this would still apply, at the time I was working on an application that needed this I ended up making it MVC based with the capability to doing web forms as well. For the page that needed the file manager I simply used the one that already existed for web forms at the time, and the rest of my application was MVC.
0
Dimo
Telerik team
answered on 27 Jun 2016, 08:57 AM
Hello,

Yes, the information in this thread is still valid.

Regards,
Dimo
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
Editor
Asked by
Matthew R.
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Carl
Top achievements
Rank 1
Matthew R.
Top achievements
Rank 1
Share this question
or