郁闷的dsoframer保存word问题
最近在写oa的时候用dsoframer保存word,自己找了个例子对word的修改保存测试没有问题,可是照着移植自己程序的时候就是没法保存对word的修改,文件访问权限也设置与例子一样 下面贴上自己的代码,请看看问题出在那里
这是显示界面
<script language="javascript" type="text/javascript">
function show_word() //打开word
{
document.all.MyOffice.Open("http://localhost:2222/zg/wordreport/2011.doc", false,"Word.Document");
}
function SaveToWeb()
{
document.all.MyOffice.HttpInit();
document.all.MyOffice.HttpAddPostCurrFile("File", "");
var src = "http://localhost:2222/zg/wk_report_list.aspx";
var returnValue=document.all.MyOffice.HttpPost(src);
if("true" == returnValue)
{
alert("文件上传成功");
} else {
alert("文件上传失败")
}
}
</script>
<form id="form1" runat="server">
<center>
<object id="MyOffice" name = "MyOffice" style="LEFT: 0px; WIDTH: 100%; TOP: 0px; HEIGHT: 500px;"
classid="clsid:00460182-9E5E-11D5-B7C8-B8269041DD57" codebase="dsoframer.ocx#version=2,2,0,0" >
</object>
<input id="Button2" type="button" value="打开word" onclick="show_word()"/>
<input id="Button3" type="submit" value="保存word" onclick="return SaveToWeb()"/>
</center>
</form>
处理页面
protected void Page_Load(object sender, EventArgs e)
{
HttpFileCollection files = System.Web.HttpContext.Current.Request.Files;
if (files.Count > 0)
{
///'检查文件扩展名字
HttpPostedFile postedFile = files[0];
string fileName, fileExtension;
fileName = System.IO.Path.GetFileName(postedFile.FileName);
if (fileName != "")
{
fileExtension = System.IO.Path.GetExtension(fileName);
///'可根据扩展名字的不同保存到不同的文件夹
///注意:可能要修改你的文件夹的匿名写入权限。
postedFile.SaveAs(System.Web.HttpContext.Current.Request.MapPath("wordreport/") + "2011"+ fileExtension);
}
}
}
现在是打开没有问题,修改就是不起作用