response.reset();
File f=new File(path+fileName);
response.setHeader("content-disposition", "attachment;filename="+fileName);
RandomAccessFile raf = new RandomAccessFile(f,"r");
byte[] line = new byte[(int)raf.length()];
raf.read(line);
response.getOutputStream().write(line);
raf.close();
File f=new File(path+fileName);
response.setHeader("content-disposition", "attachment;filename="+fileName);
RandomAccessFile raf = new RandomAccessFile(f,"r");
byte[] line = new byte[(int)raf.length()];
raf.read(line);
response.getOutputStream().write(line);
raf.close();
string strSQL;
strSQL = "Select * From tPlPlanDoc Where iID = "+striID;
dtsDoc = oAccessData.GetDataSet(strSQL);
byte[] btDoc = (byte[])dtsDoc.Tables[0].Rows[0]["gFile"];
if (btDoc.Length==0)
{
oPlan.Alert(this,"文档不存在或内容为空!请检查后,重新上传。");
Response.Write("<script language=javascript>window.close();</script>");
return;
}
Response.Buffer = true;
string strFileType = dtsDoc.Tables[0].Rows[0]["cFileType"].ToString().Trim();
if (strFileType!="text/plain")
{
Response.ContentType = strFileType;
}
Response.AppendHeader("Content-Disposition","Attachment;filename ="
+dtsDoc.Tables[0].Rows[0]["cPlanName"].ToString()); //重点是这句话
Response.BinaryWrite(btDoc);