Ordinary hut

          人間一福地,勝似天仙宮
          posts - 61, comments - 50, trackbacks - 0, articles - 1

          如何修改fckeditor的圖片上傳目錄

          Posted on 2009-06-15 15:57 landor 閱讀(1454) 評(píng)論(0)  編輯  收藏 所屬分類: web編輯器
          fck默認(rèn)的圖片上傳路徑是在fckeditor-java-core.jar的net.fckeditor.handles包下的default.properties中定義的,內(nèi)如如下:
          # base directory for the user files relative to the context root
          connector.userFilesPath = /userfiles

          fck是在net.fckeditor.handlers包中的PropertiesLoader類中聲明了一個(gè)static的properties來一次性讀入所有的配置的
          這是個(gè)靜態(tài)的屬性,而且提供了修改的權(quán)限
              /**
               * Setter for a property. If the property already exists, the value will be
               * overridden.<br />
               * <em>Hint</em>: This method is intended as an alternative way to set
               * properties programmatically instead of using the
               * <code>fckeditor.properties</code>. It should never used inside
               * FCKeditor.Java!!!
               * 
               * 
          @param key
               *            The property key.
               * 
          @param value
               *            The property value.
               * 
          @see Properties#setProperty(String, String)
               
          */
              
          public static void setProperty(final String key, final String value) {
                  properties.setProperty(key, value);
              }
          所以只需要在fck加載之前修改他既可,比如可以修改fck的例子如下:
          String userCode="xxx";//此處可以獲取登錄用戶code等動(dòng)態(tài)代碼
          PropertiesLoader.setProperty("connector.userFilesPath","/aaaa"+userCode);
          fckEditor.setValue(
          "This is some <strong>sample text</strong>. You are using <a href=\"http://www.fckeditor.net\">FCKeditor</a>.");
          out.println(fckEditor);
          這樣會(huì)生成aaaxxx文件夾

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 青田县| 鄂尔多斯市| 望奎县| 罗江县| 遂平县| 乌鲁木齐县| 应城市| 潍坊市| 吉木乃县| 筠连县| 江山市| 西贡区| 太谷县| 九龙县| 星子县| 荣昌县| 庆城县| 秦皇岛市| 淅川县| 察隅县| 探索| 东乡县| 九江市| 柏乡县| 栾城县| 安庆市| 克东县| 靖江市| 广灵县| 小金县| 祁阳县| 德令哈市| 新绛县| 永寿县| 新化县| 赣榆县| 海南省| 青神县| 循化| 扎囊县| 绥棱县|