在ASP.NET解决方案中使用CKSource.FileSystem.Local,可以通过以下步骤实现:
<script src="/path/to/ckeditor/ckeditor.js"></script>
<script src="/path/to/ckfinder/ckfinder.js"></script>
<textarea name="editor1"></textarea>
<script>
CKEDITOR.replace('editor1', {
filebrowserBrowseUrl: '/path/to/ckfinder/ckfinder.html',
filebrowserImageBrowseUrl: '/path/to/ckfinder/ckfinder.html?type=Images',
filebrowserUploadUrl: '/path/to/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Files',
filebrowserImageUploadUrl: '/path/to/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Images'
});
</script>
在上述代码中,将/path/to/
替换为CKFinder文件夹的实际路径。
config.ascx
,找到以下代码:// Set the base URL used by CKFinder to resolve URLs pointing to the resource type connectors.
// The default value is "/ckfinder/core/connector/aspx".
// Examples:
// * "/ckfinder/core/connector/aspx" - ASP.NET
// * "/ckfinder/core/connector/ashx" - ASP.NET (using ASHX handler)
// * "/ckfinder/core/connector/jsp" - JSP
// * "/ckfinder/core/connector/php" - PHP
// * "/ckfinder/core/connector/aspx" - ASP.NET (Mono - recommended for Unix/Linux servers)
// * "/ckfinder/core/connector/ashx" - ASP.NET (Mono - recommended for Unix/Linux servers)
// * "/ckfinder/core/connector/jsp" - JSP (Mono - recommended for Unix/Linux servers)
// * "/ckfinder/core/connector/php" - PHP (Mono - recommended for Unix/Linux servers)
config.BaseUrl = "/ckfinder/core/connector/aspx";
将config.BaseUrl
的值修改为CKFinder文件夹的实际路径。
config.ascx
,找到以下代码:// The local directory in which files will be stored.
// The default path is "~/userfiles/".
config.UserFilesPath = "~/userfiles/";
将config.UserFilesPath
的值修改为存储文件的实际路径。
config.ascx
,找到以下代码:// The virtual directory in which files will be stored.
// The default path is "/userfiles/".
config.UserFilesVirtualPath = "/userfiles/";
将config.UserFilesVirtualPath
的值修改为访问文件的虚拟路径。
config.ascx
,找到以下代码:// This is the list of resource types defined for this connector. A resource type is a kind of file or folder
// with a set of allowed operations, file extensions, and other settings.
config.ResourceTypes = new CkFinder.ResourceType[]
{
new CkFinder.ResourceType("Files", "Files", CkFinder.ResourceType.File),
new CkFinder.ResourceType("Images", "Images", CkFinder.ResourceType.Image)
{
// Allowed file extensions.
AllowedExtensions = new string[] { "jpg", "jpeg", "png", "gif", "bmp" },
// Denied file extensions.
DeniedExtensions = new string[] { "php", "php3", "php4", "php5", "phtml", "pl", "cgi", "asp", "aspx", "ascx", "jsp", "cfm", "cfc", "pl", "bat", "exe", "com", "dll", "vbs", "js", "reg", "cgi" },
// Maximum allowed size in KB.
MaxSize = 0,
// Whether to allow image resizing.
CanResize = true,
// Maximum image width in pixels.
MaxWidth = 0,
// Maximum image height in pixels.
MaxHeight = 0,
// Whether to allow image cropping.
CanCrop = true,
// Whether to allow image rotation.
CanRotate = true,
// Whether to keep the original image aspect ratio during resizing.
KeepAspectRatio = true,
// Whether to keep the original image format during resizing.
KeepOriginalFormat = true,
// Whether to allow image preview.
CanPreview = true
}
};
根据需要,修改config.ResourceTypes
中的资源类型和相关设置。
以上是在ASP.NET解决方案中使用CKSource.FileSystem.Local的基本步骤。通过配置CKEditor和CKFinder,您可以在ASP.NET中实现文件系统的本地操作和管理。请注意,这只是一个基本示例,您可以根据自己的需求进行更多的配置和定制化。
Hello Serverless 来了
Elastic 实战工作坊
Techo Day
云+社区技术沙龙[第9期]
云+社区开发者大会 长沙站
腾讯云GAME-TECH沙龙
云+社区技术沙龙[第8期]
GAME-TECH
云+社区技术沙龙[第6期]
领取专属 10元无门槛券
手把手带您无忧上云