将编辑html文件保存到特定文件夹

本文关键字:文件夹 保存 编辑 html 文件 | 更新日期: 2023-09-27 18:35:39

>我构建了一个项目,用户可以上传,查看,编辑并将他们的文件保存在特定的文件夹中。我使用TinyMCE进行编辑,但我找不到编辑后如何保存内容的方法。有人可以给我一些建议吗?

将编辑html文件保存到特定文件夹

假设您需要将 html 保存在根文件夹内的 HtmlFiles 文件夹中,文件名为 test.html

string path = Server.MapPath("~/HtmlFiles/test.html");
File.WriteAllText(path ,yorTextBox.Text);

以下是保存 TinyMCE 控件值的方法。

String OutPath = Server.MapPath("~/myfiles/test.txt");  // here '~/' refers to root of your website
            StreamWriter Out1 = new StreamWriter(OutPath);
            Out1.WriteLine(TextBox1.Text.Trim());
            Out1.Close(); //Close File