关于FreeTextBox中的图片上传小结

弄了一个FreeTextBox来玩.好象目前最高版本3-1-3.下载下来发现default的设置没有上传文件的功能.
看了一下,也不难.

以下作为小结,可能以后用的到.

  1. 如何设置FTB的example?
    在此文件夹内新建一个名为bin的文件夹,并把你想用的版本的FreeTextBox.dll 放进去.
    在此文件内新建一个名为web.config的文件,写入以下代码:
    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        
    <system.web>
            
    <httpHandlers>
                
    <add verb="GET" path="FtbWebResource.axd" type="FreeTextBoxControls.AssemblyResourceHandler, FreeTextBox" />
        
    </httpHandlers>
    </system.web>
    </configuration>

        把textbox中的aspnet_client 拷到此文件夹内.
运行,应该没有其它问题了.

    2.如何修改FTB使其支持图片上传(其实就是在按钮中加上一个上传图片的按钮)
       把示例中的textbox\examples\fully_loaded_external\ftb.imagegallery.aspx 这个文件放在FTB所在的文件夹中.
       修改FTB页面的HTML代码:

<FTB:FreeTextBox id="FreeTextBox1" Focus="true"
            SupportFolder
="~/aspnet_client/FreeTextBox/"
            JavaScriptLocation
="ExternalFile" 
            ButtonImagesLocation
="ExternalFile"
            ToolbarImagesLocation
="ExternalFile"
            ToolbarStyleConfiguration
="officeXP"            
            toolbarlayout
="ParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorsMenu,FontForeColorPicker,FontBackColorsMenu,
FontBackColorPicker|Bold,Italic,Underline,Strikethrough,Superscript,Subscript,RemoveFormat|JustifyLeft,JustifyRight,JustifyCenter,
JustifyFull;BulletedList,NumberedList,Indent,Outdent;CreateLink,Unlink,InsertImage|Cut,Copy,Paste,Delete;Undo,Redo,Print,Save|
SymbolsMenu,StylesMenu,InsertHtmlMenu|InsertRule,InsertDate,InsertTime|InsertTable,EditTable;InsertTableRowAfter,
InsertTableRowBefore,DeleteTableRow;InsertTableColumnAfter,InsertTableColumnBefore,DeleteTableColumn|InsertForm,InsertTextBox,
InsertTextArea,InsertRadioButton,InsertCheckBox,InsertDropDownList,InsertButton|InsertDiv,EditStyle,InsertImageFromGallery,
Preview,SelectAll,WordClean,NetSpell"

            runat
="Server"
            GutterBackColor
="red"
            DesignModeCss
="designmode.css"         
            
/>

全显示出来了吧...............
余下的事情就是保存了..............

    3.如何修改上传文件的默认文件夹
       在page_load的时候指定FTB的图片路径即可,如

        private void Page_Load(object sender, System.EventArgs e)
        {
            
// 在此处放置用户代码以初始化页面
            FreeTextBox1.ImageGalleryPath="yourUploadFolder";
            
        }


其中yourUploadFolder 就是你自己设定的上传路径了,不过要注意这是相对于FTB所在位置的一个相对路径.
推荐使用配置文件搞定.

原文地址:https://www.cnblogs.com/niaowo/p/2128608.html