81,092
社区成员
发帖
与我相关
我的任务
分享
document.all.FramerControl1.HttpInit();
// document.all.FramerControl1.HttpAddPostString("RecordID",nowtime);
// document.all.FramerControl1.HttpAddPostString("UserID",username);
// document.all.FramerControl1.HttpAddPostString("FileName",filename);//不能自定义参数,否则保存文件成乱码,定义其它参数貌似在后台需要截取出来,否则文件编码不对。
// document.all.FramerControl1.HttpAddPostString("SavePath",savepath);
document.all.FramerControl1.HttpAddPostCurrFile("FileData", "");
document.all.FramerControl1.HttpPost(path);
string newFile = context.Server.MapPath("..") + context.Request.Params["FileName"];
if (context.Request.Files.Count == 0)
{
context.Response.Write("没有文件!");
return;
}
if (context.Request.Files[0].ContentLength == 0)
{
context.Response.Write("保存失败!");
return;
}
//定义保存文件的物理路径
//string strTmpPath = System.IO.Path.GetDirectoryName(Page.Request.PhysicalPath);
//定义保存文件的服务器路径
// string strUpLoadFilePath = strTmpPath + @"\doc\";
//string fullFileName = strUpLoadFilePath + strFileName + "." + strFileType;
context.Request.Files[0].SaveAs(newFile);
context.Response.Write("保存成功!");
context.Response.Flush();
// context.Response.End();
sb.append("--");
sb.append(BOUNDARY);
sb.append("\r\n");
sb.append("Content-Disposition: form-data;name=\"myfile\";filename=\""+ file.getName() + "\"\r\n");
sb.append("Content-Type:application/octet-stream\r\n\r\n");