20230307 质量在线文档编辑修改
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace WordEdit
|
||||
{
|
||||
public partial class save : System.Web.UI.Page
|
||||
{
|
||||
|
||||
//参数savetype定义要另存的文档格式office,html,pdf
|
||||
//参数filetype定义要保存的文档的文件内型
|
||||
public string savetype, filetype, fid, title, fother, fname, fname1;
|
||||
|
||||
//定义文件上传路径目录
|
||||
public string filepath, htmlpath, pdfpath, attachpath, delcount;
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
//Response.Write("ok");
|
||||
//Response.End();
|
||||
fid = Request.Form["fileid"];//获取文件ID
|
||||
fname = Request.Form["filename"];//获取已有文件的名称
|
||||
title = Request.Form["filetitle"];//获取文件的标题
|
||||
savetype = Request.Form["savetype"];//获取文件另存为格式类型
|
||||
filetype = Request.Form["filetype"];//获取当前文件的文件格式
|
||||
fother = Request.Form["fileother"];
|
||||
//filepath = db.getofficepath();
|
||||
//htmlpath = db.gethtmlpath();
|
||||
//pdfpath = db.getpdfpath();
|
||||
//attachpath = db.getattachpath();
|
||||
filepath = "D:\\我的代码\\在线文档编辑\\WordEdit\\WordEdit";
|
||||
htmlpath = "";
|
||||
pdfpath = "";
|
||||
attachpath = "";
|
||||
//根据保存类型调用相应处理方法
|
||||
switch (savetype)
|
||||
{
|
||||
case "1":
|
||||
saveoffice();
|
||||
break;
|
||||
|
||||
default:
|
||||
saveoffice();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//保存文档为office
|
||||
public void saveoffice()
|
||||
{
|
||||
string uploadoffiepath = Server.MapPath("~/");//上传文件的路径
|
||||
// string uploadoffiepath = filepath;//上传文件的路径
|
||||
string attpath = Server.MapPath(attachpath);//上传附件文件路径
|
||||
|
||||
System.Web.HttpFileCollection uploadFiles = Request.Files;
|
||||
System.Web.HttpPostedFile theFile;
|
||||
theFile = uploadFiles[0];
|
||||
if (uploadFiles.GetKey(0).ToUpper() == "EDITFILE")//上传文档控件中的文档
|
||||
{
|
||||
|
||||
/* string time = System.DateTime.Now.ToString();
|
||||
if (fname == "" || fname == null)
|
||||
{
|
||||
fname = time + "." + theFile.FileName.Substring(theFile.FileName.LastIndexOf('\\') + 1);
|
||||
}
|
||||
fname = fname.Replace(":", ".");//上传文件到磁盘,文件名中不允许带:符号*/
|
||||
// theFile.SaveAs(uploadoffiepath + @"\" + fname);
|
||||
var path = theFile.FileName.Replace(Funs.SGGLUrl, "");
|
||||
theFile.SaveAs(uploadoffiepath + path);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user