0
내 코드RadGridAttachmentColumn에서 바이너리 데이터를 다운로드하는 방법은 무엇입니까?
protected void grdFiles_ItemCommand(object source, GridCommandEventArgs e)
{
if (e.CommandName == RadGrid.DownloadAttachmentCommandName)
{
GridDownloadAttachmentCommandEventArgs args = e as GridDownloadAttachmentCommandEventArgs;
string fileName = args.FileName;
int attachmentId = (int)args.AttachmentKeyValues["ProjectFileId"];
ProTrakEntities objEntity = new ProTrakEntities();
ProjectFile objFile = (from type in objEntity.ProjectFiles where type.ProjectFileId == attachmentId select type).First();
string filename = objFile.FileName;
string Filetype = objFile.FileType;
byte[] binaryData = (byte[])objFile.FileData;
//byte[] binaryData = (byte[])data.Tables[0].Rows[0]["BinaryData"];
// Response.AppendHeader("Content-Disposition", "attachment; filename = "+filename);
// Response.AppendHeader("Content-Length", filename.Length.ToString());
//Response.ContentType = Filetype;
//Response.WriteFile(Server.MapPath("Uploads/"+filename));
//Response.Flush();
//Response.Close();
//Response.End();
// grdFiles.Items[0].FireCommandEvent(RadGrid.DownloadAttachmentCommandName, parameters);
Response.Clear();
Response.ContentType = Filetype;
Response.AddHeader("content-disposition", "attachment; filename=" + fileName);
Response.BinaryWrite(binaryData);
Response.End();
}
}
내가 서버 측에서 다운로드 할 때 작동하지 않는 지역 고객과의 면담에서 다운로드 할 수 Database.I에 바이너리 데이터로 변환 및 저장 업로드 된 데이터를 디버깅.