I had to create a support ticket to find out how to override the save as function, because I needed to strip all special characters from the file name. There are demos that show creating a custom provider, but they involve a lot of code and methods, and I only wanted to override the file save.
Telerik gave me a great solution, so I thought I would pass it on. I am not sure why they don't make public the resolutions to these support tickets in some generic way, it seems like it would be useful to a lot of us out there.
anyways, here is the class file for the custom provider:
And it is implemented on the individual control like so:
Hopefully, this can be helpful to somebody.
Telerik gave me a great solution, so I thought I would pass it on. I am not sure why they don't make public the resolutions to these support tickets in some generic way, it seems like it would be useful to a lot of us out there.
anyways, here is the class file for the custom provider:
using System.IO;
using System.Web;
using Telerik.Web.UI;
using Telerik.Web.UI.Widgets;
namespace Blah.BlahBlah
{
public class CustomFileSystemProvider : FileSystemContentProvider
{
public CustomFileSystemProvider(HttpContext context, string[] searchPatterns, string[] viewPaths, string[] uploadPaths, string[] deletePaths, string selectedUrl, string selectedItemTag)
: base(context, searchPatterns, viewPaths, uploadPaths, deletePaths, selectedUrl, selectedItemTag)
{
}
public override string StoreFile(UploadedFile file, string path, string name, params string[] arguments)
{
string fileName = Helper.RemoveSpecialCharacters(file.GetName());
string pathToSave = Path.Combine(Context.Server.MapPath(path), fileName);
file.SaveAs(pathToSave);
string virtualPath = VirtualPathUtility.Combine(path, fileName);
return virtualPath;
}
}
}
FileExplorer1.Configuration.ContentProviderTypeName = typeof(CustomFileSystemProvider).AssemblyQualifiedName;
Hopefully, this can be helpful to somebody.