您的位置:首页 > 数据库 > Oracle

使用流上传WORD和下载WORD(oracle)

2008-03-28 20:38 351 查看
1private void Button1_Click(object sender, System.EventArgs e)//上传
2
20 private void Button2_Click(object sender, System.EventArgs e)//下载
21
48

PS:给下载文件指定默认名

   Response.AddHeader("Content-Type", StrDownType(fileExten));
   Response.AddHeader("Content-Disposition", "attachment;filename="+HttpUtility.UrlEncode("自定义文件名", System.Text.Encoding.UTF8)+"."+fileExten);

   /// <summary>
/// 根据后缀确定流类型
/// </summary>
/// <param name="extension">后缀名</param>
/// <returns></returns>
private static string StrDownType(string extension)
{
if (extension == "doc" || extension == "docx")
{
return "application/msword";
}
else if (extension == "xls" || extension == "xlsx")
{
return "application/vnd.ms-excel";
}
return "text/html";
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: