//以下是下载操作
string id = this.gvwDownLond.DataKeys[e.NewEditIndex].Value.ToString();
AccessoryFile file = AccessoryFileManage.GetAccessoryFileModel(int.Parse(id));//根据编号得到对象
//以下是下载操作
System.IO.FileInfo fileInfo = new System.IO.FileInfo(file.AccessoryPath);
Response.Clear();
Response.ContentType = "application/octet-stream";//设置下载头部样式
Response.AddHeader("Content-Disposition", "acctachment;filename=" + HttpUtility.UrlEncode(fileInfo.Name, System.Text.Encoding.UTF8));
Response.AddHeader("content-length", fileInfo.Name.Length.ToString());//设置下载头部标题
Response.Flush();//清除文件流
Response.WriteFile(file.AccessoryPath);
string id = this.gvwDownLond.DataKeys[e.NewEditIndex].Value.ToString();
AccessoryFile file = AccessoryFileManage.GetAccessoryFileModel(int.Parse(id));//根据编号得到对象
//以下是下载操作
System.IO.FileInfo fileInfo = new System.IO.FileInfo(file.AccessoryPath);
Response.Clear();
Response.ContentType = "application/octet-stream";//设置下载头部样式
Response.AddHeader("Content-Disposition", "acctachment;filename=" + HttpUtility.UrlEncode(fileInfo.Name, System.Text.Encoding.UTF8));
Response.AddHeader("content-length", fileInfo.Name.Length.ToString());//设置下载头部标题
Response.Flush();//清除文件流
Response.WriteFile(file.AccessoryPath);