Ordinary hut

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

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

          Posted on 2009-06-15 15:57 landor 閱讀(1446) 評論(0)  編輯  收藏 所屬分類: web編輯器
          fck默認的圖片上傳路徑是在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類中聲明了一個static的properties來一次性讀入所有的配置的
          這是個靜態(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等動態(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);
          這樣會生成aaaxxx文件夾

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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 韶关市| 崇义县| 仲巴县| 滨海县| 沁源县| 蓬安县| 木兰县| 涞水县| 连平县| 瓮安县| 兰州市| 繁峙县| 鄢陵县| 遂溪县| 师宗县| 潼关县| 南溪县| 博罗县| 南宁市| 鹤壁市| 南昌县| 嘉荫县| 阿克苏市| 游戏| 城口县| 调兵山市| 平定县| 岫岩| 莱阳市| 新闻| 修水县| 普定县| 大厂| 石狮市| 德昌县| 道孚县| 沧源| 东乡族自治县| 刚察县| 合水县| 秀山|