如何获取保存路径? 在C#中可以通过OpenFileDialog控件来获取保存文件的路径,在asp.net中怎么来获取啊?我想保存页面上的数据到文件。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 js: document.execCommand ("SaveAs",true,"xx.htm"); 类似protected void Page_Load(object sender, EventArgs e) { Response.ClearContent(); Response.ContentType = "application/octet-stream"; Response.AddHeader("Content-Disposition", "attachment;FileName=123.txt"); Response.Write("asdf"); Response.End(); } server.mappath找到存放路径然后在指定到具体文件夹但这是保存在服务器上的你还要下载下来 到本地 string path = "../../UploadFiles/shipin/"; Helper helper = new Helper(); string strPath = helper.Upload(path, FU2, true, this.Page); if (strPath != "") { hl.Text = strPath; hl.NavigateUrl = path + strPath; } public string Upload(string path, HtmlInputFile uploadcrtl, bool isimg, Page page) { if (IsFile(uploadcrtl, isimg, page)) { FileInfo info = new FileInfo(uploadcrtl.PostedFile.FileName); string newname = info.Name; if (File.Exists(Server.MapPath(path + newname))) { Alert("文件名已存在!请更改文件名后再上传!", page); newname = null; } else { uploadcrtl.PostedFile.SaveAs(Server.MapPath(path + newname)); Alert("上传成功!", page); } return newname; } else { return null; } } 用openfilename过度,用openfilepath获得 求教在web 中打开 word (文字、表格、图片等格式都不能乱) 一个WebService将CS代码生成dll然后用GetSystemDiagnostics.asmx/js访问就会出错. 【求助】用服务器端控件table 我想在一列中添加超链接,请问该怎么做呢?? [求助]如何实现购物车 急急急... XML读取子节点 cookie高分请教 女孩子作IT是不是真的不适合?有点困惑。。 给有人知道怎么更改一个表中字段的数据类型??? 求asp.net视频生成技术 求助:如何获取String的字节数? 请各位高人指点一下连接SQlite的入门级问题! asp.net 后台地址访问问题
document.execCommand ("SaveAs",true,"xx.htm");
{
Response.ClearContent();
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment;FileName=123.txt");
Response.Write("asdf");
Response.End();
}
然后在指定到具体文件夹但这是保存在服务器上的
你还要下载下来 到本地
Helper helper = new Helper();
string strPath = helper.Upload(path, FU2, true, this.Page);
if (strPath != "")
{
hl.Text = strPath;
hl.NavigateUrl = path + strPath;
} public string Upload(string path, HtmlInputFile uploadcrtl, bool isimg, Page page)
{
if (IsFile(uploadcrtl, isimg, page))
{
FileInfo info = new FileInfo(uploadcrtl.PostedFile.FileName);
string newname = info.Name;
if (File.Exists(Server.MapPath(path + newname)))
{
Alert("文件名已存在!请更改文件名后再上传!", page);
newname = null;
}
else
{
uploadcrtl.PostedFile.SaveAs(Server.MapPath(path + newname));
Alert("上传成功!", page);
}
return newname;
}
else
{ return null; }
}