急急急急!!!!!最近在用FCKeditor+Ckfinder,出现了几个问题,望大虾们帮忙解决!!!!!!

华丽丽的小低调 2011-05-09 12:17:05
碰到的第一个比较棘手的问题:我FCKeditor+Ckfinder都配置好了,已经可以用了,但是发现上传图片后,图片默认保存在C:\Inetpub\wwwroot\ckfinder\userfiles 目录下,因为要做很多网站所以不可能所有用户的文件都放在一起,而我希望他们上传的文件都保存在他们自己的站点目录下,我看了N多帖子,最后还是设置了绝对路径。有没有办法设相对路径让上传的文件都保存在他们自己的站点目录下?
我用的是ckfinder_aspnet_2.0.2.1
其中config.ascx代码已经修改如下:

<%@ Control Language="C#" EnableViewState="false" AutoEventWireup="false" Inherits="CKFinder.Settings.ConfigFile" %>
<%@ Import Namespace="CKFinder.Settings" %>
<script runat="server">

/**
* This function must check the user session to be sure that he/she is
* authorized to upload and access files using CKFinder.
*/
public override bool CheckAuthentication()
{
// WARNING : DO NOT simply return "true". By doing so, you are allowing
// "anyone" to upload and list the files in your server. You must implement
// some kind of session validation here. Even something very simple as...
//
// return ( Session[ "IsAuthorized" ] != null && (bool)Session[ "IsAuthorized" ] == true );
//
// ... where Session[ "IsAuthorized" ] is set to "true" as soon as the
// user logs on your system.

return true;
}

/**
* All configuration settings must be defined here.
*/
public override void SetConfig()
{
// Paste your license name and key here. If left blank, CKFinder will
// be fully functional, in Demo Mode.
LicenseName = "";
LicenseKey = "";

// The base URL used to reach files in CKFinder through the browser.
// BaseUrl = "/ckfinder/userfiles/";
BaseUrl = "ckfinder/userfiles/";



// The phisical directory in the server where the file will end up. If
// blank, CKFinder attempts to resolve BaseUrl.
//BaseDir = Server.MapPath(BaseUrl) + "/";
BaseDir = "D:/_Samples/ckfinder/userfiles/";
//BaseDir = "";


// Optional: enable extra plugins (remember to copy .dll files first).
Plugins = new string[] {
// "CKFinder.Plugins.FileEditor, CKFinder_FileEditor",
// "CKFinder.Plugins.ImageResize, CKFinder_ImageResize",
// "CKFinder.Plugins.Watermark, CKFinder_Watermark"
};
// Settings for extra plugins.
PluginSettings = new Hashtable();
PluginSettings.Add("ImageResize_smallThumb", "90x90" );
PluginSettings.Add("ImageResize_mediumThumb", "120x120" );
PluginSettings.Add("ImageResize_largeThumb", "180x180" );
// Name of the watermark image in plugins/watermark folder
PluginSettings.Add("Watermark_source", "logo.gif" );
PluginSettings.Add("Watermark_marginRight", "5" );
PluginSettings.Add("Watermark_marginBottom", "5" );
PluginSettings.Add("Watermark_quality", "90" );
PluginSettings.Add("Watermark_transparency", "80" );

// Thumbnail settings.
// "Url" is used to reach the thumbnails with the browser, while "Dir"
// points to the physical location of the thumbnail files in the server.
Thumbnails.Url = BaseUrl + "_thumbs/";
//Thumbnails.Dir = "";

if ( BaseDir != "" ) {
Thumbnails.Dir = BaseDir + "_thumbs/";
//Thumbnails.Dir ="";
}

Thumbnails.Enabled = true;
Thumbnails.DirectAccess = false;
Thumbnails.MaxWidth = 100;
Thumbnails.MaxHeight = 100;
Thumbnails.Quality = 80;

// Set the maximum size of uploaded images. If an uploaded image is
// larger, it gets scaled down proportionally. Set to 0 to disable this
// feature.
Images.MaxWidth = 1600;
Images.MaxHeight = 1200;
Images.Quality = 80;

// Indicates that the file size (MaxSize) for images must be checked only
// after scaling them. Otherwise, it is checked right after uploading.
CheckSizeAfterScaling = true;

// Due to security issues with Apache modules, it is recommended to leave the
// following setting enabled. It can be safely disabled on IIS.
ForceSingleExtension = true;

// For security, HTML is allowed in the first Kb of data for files having the
// following extensions only.
HtmlExtensions = new string[] { "html", "htm", "xml", "js" };

// Folders to not display in CKFinder, no matter their location. No
// paths are accepted, only the folder name.
// The * and ? wildcards are accepted.
HideFolders = new string[] { ".svn", "CVS" };

// Files to not display in CKFinder, no matter their location. No
// paths are accepted, only the file name, including extension.
// The * and ? wildcards are accepted.
HideFiles = new string[] { ".*" };

// Perform additional checks for image files.
SecureImageUploads = true;

// The session variable name that CKFinder must use to retrieve the
// "role" of the current user. The "role" is optional and can be used
// in the "AccessControl" settings (bellow in this file).
RoleSessionVar = "CKFinder_UserRole";

// ACL (Access Control) settings. Used to restrict access or features
// to specific folders.
// Several "AccessControl.Add()" calls can be made, which return a
// single ACL setting object to be configured. All properties settings
// are optional in that object.
// Subfolders inherit their default settings from their parents' definitions.
//
// - The "Role" property accepts the special "*" value, which means
// "everybody".
// - The "ResourceType" attribute accepts the special value "*", which
// means "all resource types".
AccessControl acl = AccessControl.Add();
acl.Role = "*";
acl.ResourceType = "*";
acl.Folder = "/";

acl.FolderView = true;
acl.FolderCreate = true;
acl.FolderRename = true;
acl.FolderDelete = true;

acl.FileView = true;
acl.FileUpload = true;
acl.FileRename = true;
acl.FileDelete = true;

// Resource Type settings.
// A resource type is nothing more than a way to group files under
// different paths, each one having different configuration settings.
// Each resource type name must be unique.
// When loading CKFinder, the "type" querystring parameter can be used
// to display a specific type only. If "type" is omitted in the URL,
// the "DefaultResourceTypes" settings is used (may contain the
// resource type names separated by a comma). If left empty, all types
// are loaded.

DefaultResourceTypes = "";

ResourceType type;

type = ResourceType.Add( "Files" );
type.Url = BaseUrl + "files/";
type.Dir = BaseDir == "" ? "" : BaseDir + "files/";
type.MaxSize = 0;
type.AllowedExtensions = new string[] { "7z", "aiff", "asf", "avi", "bmp", "csv", "doc", "docx", "fla", "flv", "gif", "gz", "gzip", "jpeg", "jpg", "mid", "mov",

"mp3", "mp4", "mpc", "mpeg", "mpg", "ods", "odt", "pdf", "png", "ppt", "pptx", "pxd", "qt", "ram", "rar", "rm", "rmi", "rmvb", "rtf", "sdc", "sitd", "swf", "sxc", "sxw", "tar",

"tgz", "tif", "tiff", "txt", "vsd", "wav", "wma", "wmv", "xls", "xlsx", "zip" };
type.DeniedExtensions = new string[] { };

type = ResourceType.Add( "Images" );
type.Url = BaseUrl + "images/";
type.Dir = BaseDir == "" ? "" : BaseDir + "images/";
type.MaxSize = 0;
type.AllowedExtensions = new string[] { "bmp", "gif", "jpeg", "jpg", "png" };
type.DeniedExtensions = new string[] { };

type = ResourceType.Add( "Flash" );
type.Url = BaseUrl + "flash/";
type.Dir = BaseDir == "" ? "" : BaseDir + "flash/";
type.MaxSize = 0;
type.AllowedExtensions = new string[] { "swf", "flv" };
type.DeniedExtensions = new string[] { };
}




</script>



其中标红的为修改过的代码,这样设置了绝对路径虽然达到了效果,可是每个站点都要修改岂不是很麻烦?

第二个问题:当
BaseUrl = "/ckfinder/userfiles/";
BaseDir = "";
我上传到服务器的图片可以立刻显示出缩略图(这是默认上传到C:\Inetpub\wwwroot\ckfinder\userfiles 目录下的图片),但是改成绝对路径后,上传的图片不能立即显示缩略图,要刷新一下才显示,什么问题啊?百思不得其解....

求救 !!!求救!!!!
...全文
451 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
sxfsuper 2011-08-03
  • 打赏
  • 举报
回复
同样有这个问题~到现在还没解决也不知道是为什么。难道是域名解析不出来
  • 打赏
  • 举报
回复
if ( BaseDir != "" )
{
Thumbnails.Dir = BaseDir + "_thumbs/";
//Thumbnails.Dir ="";
}

这是缩略图的路径。我改成Thumbnails.Dir ="";
结果没一点效果,上传后还是要刷新下才显示缩略图....
孟子E章 2011-05-09
  • 打赏
  • 举报
回复
图片的位置显示出来了吗?点击右键看图片地址正确吗?
脚本出现错误(用错误控制台看)了吗?
  • 打赏
  • 举报
回复
没有人回答?悲催ing
内容概要:本文系统梳理了计算机组成原理的完整知识体系,重点围绕冯·诺依曼体系结构、五大核心硬件(运算器、控制器、存储器、输入/输出设备)、数据表示与运算、存储层级、CPU架构、总线系统及I/O控制机制展开,深入剖析了硬件底层如何支撑Java程序的运行,特别是与JVM内存模型、多线程并发、IO操作、性能调优等关键技术的紧密关联。文章强调通过理解二进制编码、补码运算、缓存机制、指令流水线、乱序执行、中断与DMA等底层原理,帮助Java开发者从根本上解释浮点精度丢失、数值溢出、线程安全、伪共享、IO阻塞等常见问题,并提供性能优化的硬件级视角。; 适合人群:具备一定Java开发基础,工作1-3年,希望深入理解JVM、并发编程、IO模型底层原理的后端研发人员。; 使用场景及目标:① 理解Java代码从编译到执行的完整软硬件链路;② 掌握JVM内存布局、GC机制、线程上下文切换、volatile与synchronized的硬件实现原理;③ 分析并解决高并发、高性能场景下的性能瓶颈,如缓存命中率低、伪共享、总线争用、IO阻塞等问题;④ 在面试中清晰阐述Java底层与计算机硬件的关联,展现扎实的系统功底。; 阅读建议:建议按照文档提供的“八、学习顺序”分阶段学习,每学完一个硬件模块,立即结合对应的Java技术点(如学到Cache时思考伪共享和@Contended)进行复盘,将抽象硬件原理具象化到日常开发场景中,以达到学以致用的目的。
源码链接: https://pan.quark.cn/s/044c82337b8e Teamcenter 12的中文版帮助文档中,1-1基础模块入门部分,详细介绍了产品设计、产品文档、产品结构、业务流程、客户端与集成接口、AWC、Rich client以及TC的安装与配置等内容,非常适合初学者或者希望了解Teamcenter 12的读者。Teamcenter 12是由Siemens开发的一款功能强大的产品生命周期管理(PLM)软件,它包含了产品设计、产品文档、产品结构、业务流程等多个领域,旨在帮助企业高效地管理产品开发的全过程。以下是对这些核心知识点的具体阐述: 1-1 Teamcenter简介: Teamcenter作为一个综合性的PLM解决方案,提供了一个集中化的平台来存储、管理和协同所有的产品相关信息。它支持跨部门、跨地域的合作,通过集成CAD系统、业务流程管理工具和数据管理功能,确保了数据的一致性和准确性。 1-1 产品设计: Teamcenter能够管理各种工程设计数据,包括3D模型、图纸、参数化数据等。用户可以方便地查找和组织产品设计数据,进行签出和签入操作以保证版本控制,确保在团队协作中避免数据冲突。 1-2 查找和组织产品设计: 在Teamcenter中,用户可以通过高级搜索功能迅速定位所需的设计文件,同时,系统支持自定义视图和分类,使设计数据的组织更加系统化。 1-3 签出和签入产品设计: 签出和签入机制是Teamcenter中防止数据冲突的重要功能。签出允许用户独占性地编辑某个设计文件,而签入则将更新后的文件版本提交回系统,供其他团队成员查看或编辑。 1-4 产品文档: Teamcenter不仅管理设计数据,还涵盖了产品相关的文档,如规格...

111,129

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧