I added a Kendo Editor along with the FileBrowserController and ImageBrowserController per the example - File and Image Browser. My problem is the filter prevents all files from displaying. If the filter is in place I can't see any files in the directory even though there are files there with the correct extensions. If I comment out the filter I can see the files. I can see the Filter value getting set correctly in the debugger. Not sure how to fix this.
public
class
FileBrowserController : EditorFileBrowserController
{
private
const
string
contentFolderRoot =
"~/Content/"
;
private
const
string
prettyName =
"Documents"
;
/// <summary>
/// Gets the base paths from which content will be served.
/// </summary>
public
override
string
ContentPath
{
get
{
return
CreateUserFolder();
}
}
/// <summary>
/// Gets the valid file extensions by which served files will be filtered.
/// </summary>
public
override
string
Filter
{
get
{
return
"*.txt, *.doc, *.docx, *.xls, *.xlsx, *.ppt, *.pptx, *.jpg, *.jpeg, *.gif, *.png, *.pdf"
;
}
}
private
string
CreateUserFolder()
{
var virtualPath = Path.Combine(contentFolderRoot,
"Clients"
, prettyName);
var path = Server.MapPath(virtualPath);
if
(!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
return
virtualPath;
}
}
@(Html.Kendo().Editor()
.Name("editor")
.HtmlAttributes(new { style = "height:440px" })
.Tools(tools => tools.Clear().InsertImage().InsertFile())
.Value(@<
text
>
<
p
>
Kendo UI Editor allows your users to edit HTML in a familiar, user-friendly way.<
br
/>
In this version, the Editor provides the core HTML editing engine, which includes basic text formatting, hyperlinks, lists,
and image handling. The widget <
strong
>outputs identical HTML</
strong
> across all major browsers, follows
accessibility standards and provides API for content manipulation.
</
p
>
<
p
>Features include:</
p
>
<
ul
>
<
li
>Text formatting & alignment</
li
>
<
li
>Bulleted and numbered lists</
li
>
<
li
>Hyperlink and image dialogs</
li
>
<
li
>Cross-browser support</
li
>
<
li
>Identical HTML output across browsers</
li
>
<
li
>Gracefully degrades to a <
code
>textarea</
code
> when JavaScript is turned off</
li
>
</
ul
>
<
p
>
Read <
a
href
=
"http://docs.telerik.com/kendo-ui"
>more details</
a
> or send us your
<
a
href
=
"http://www.telerik.com/forums"
>feedback</
a
>!
</
p
>
</
text
>)
.ImageBrowser(imageBrowser => imageBrowser
.Image("~/Content/Clients/Images/{0}")
.Read("Read", "ImageBrowser")
.Create("Create", "ImageBrowser")
.Destroy("Destroy", "ImageBrowser")
.Upload("Upload", "ImageBrowser")
.Thumbnail("Thumbnail", "ImageBrowser"))
.FileBrowser(fileBrowser => fileBrowser
.File("~/Content/Clients/Documents/{0}")
.Read("Read", "FileBrowser")
.Create("Create", "FileBrowser")
.Destroy("Destroy", "FileBrowser")
.Upload("Upload", "FileBrowser")
)
)