开发者

how to add image to html file which is created using file.create method

开发者 https://www.devze.com 2023-02-26 10:58 出处:网络
i am creating html file by using below code string path = HttpContext.Current.Server.MapPath(\"Attachments/test.html\");

i am creating html file by using below code

string path = HttpContext.Current.Server.MapPath("Attachments/test.html");

// Delete the file if it exists.
if (File.Exists(path))
{
    File.Delete(path);
}

// Create the file.
using (FileStream fs = File.Create(path, 1024))
{
    byte[] info = new UTF8Encoding(true).GetBytes("<html><body><div>Test</div></body><html>");

    /开发者_如何学编程/ Add some information to the file.
    fs.Write(info, 0, info.Length);
}

I want to add a image to this html file... how to add image to this html file.


 byte[] info = new UTF8Encoding(true).GetBytes("<html><body><div>Test</div><img src='image.png' alt='your added image'/></body><html>");
0

精彩评论

暂无评论...
验证码 换一张
取 消