文件的byte[]和名稱(含格式)存在數(shù)據(jù)庫,輸出到瀏覽器的時候內(nèi)容是空的。文件的格式不確定,這個時候contenttype應(yīng)該指定成什么,我現(xiàn)在是application/octet-stream,但是測試了下doc、txt、jpg輸出都是空的。代碼: Response.Clear(); Response.ContentType = "application/octet-stream"; Response.AddHeader("Content-Length", bin.Length.ToString()); Response.AddHeader("Content-Disposition", "attachment; filename=" Server.UrlEncode(query.Filename)); Response.OutputStream.Write(bin,0,bin.Length); //Response.BinaryWrite()也不行 Response.Flush(); // Response.End();
- 2 回答
- 0 關(guān)注
- 599 瀏覽
添加回答
舉報
0/150
提交
取消