简体   繁体   English

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

[英]Save editing html file to specific folder

I have build a project that user can upload,view,edit and save their file in the specific folder. 我建立了一个项目,用户可以上载,查看,编辑并将其文件保存在特定的文件夹中。 I using TinyMCE for the editing but I can't find the way how to save the content after editing. 我使用TinyMCE进行编辑,但是在编辑后找不到如何保存内容的方法。 Anybody can give some advice to me? 有人可以给我一些建议吗?

here is how you can save values of your TinyMCE control. 这是保存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

Assume you need to save the html in the HtmlFiles folder inside your root folder and the file name is test.html . 假设您需要将html保存在根文件夹内的HtmlFiles文件夹中,文件名为test.html

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM