private void CreateDirectory() { m_pathFile = PathFiles.GetPathFooter(); if (!Directory.Exists(Server.MapPath(m_pathFile))) { Directory.CreateDirectory(Server.MapPath(m_pathFile)); } Session["FileManager"] = m_pathFile; }
private void SaveHTMLInfo2() { try { string strHTMLFileLocation; string strFileName; string strHTMLContent; StreamWriter fsoFile; strFileName = PathFiles.GetPathFooter() + "/thanhtruot-vi.htm"; strHTMLFileLocation = Server.MapPath(strFileName); strHTMLContent = mrk2.Value; fsoFile = File.CreateText(strHTMLFileLocation); fsoFile.Write(strHTMLContent); fsoFile.Close(); } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } }
private void showFileHTML() { try { string pathFile; string strHTMLContent; pathFile = Server.MapPath(PathFiles.GetPathFooter() + "/footer-vi.htm"); if ((File.Exists(pathFile))) { StreamReader objNewsReader; //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default) objNewsReader = new StreamReader(pathFile); strHTMLContent = objNewsReader.ReadToEnd(); objNewsReader.Close(); mrk.Value = strHTMLContent; //mrkEn.Value = strHTMLContentEn; } } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } }
protected void Btupmulti_Click(object sender, EventArgs e) { try { if (FileUpload1.HasFile) { HttpFileCollection hfc = Request.Files; List <string> lpath = new List <string>(); for (int i = 0; i < hfc.Count; i++) { HttpPostedFile hpf = hfc[i]; if (hpf.ContentLength > 0) { string pathfile = Server.MapPath("/data/footer/"); string fullpathfile = pathfile + "/" + Path.GetFileName(hpf.FileName); lpath.Add(PathFiles.GetPathFooter() + Path.GetFileName(hpf.FileName)); if (!Directory.Exists(pathfile)) { Directory.CreateDirectory(pathfile); } hpf.SaveAs(fullpathfile); } } string listimg = string.Empty; for (int s = 0; s < lpath.Count; s++) { listimg += "<p><img src='" + lpath[s] + "' alt=''/></p>"; } mrk.Value += listimg; } } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } }