小编Jaz*_*ngo的帖子

从会话中获取文件时出现"无法访问已关闭的文件"错误消息

我有一个asp.net FileUpload控件.我可以在会话中成功上传文件到存储,但是当我想要获取其输入流(我在HttpPosterFile中存储文件)时,我收到错误

无法访问已关闭的文件

tr.PostedFile //<== HttpPostedFile; 
byte[] byteArray = null; 
using (var binaryReader = new BinaryReader(tr.PostedFile.InputStream)) 
{ 
    byteArray = binaryReader.ReadBytes(tr.PostedFile.ContentLength); 
}
Run Code Online (Sandbox Code Playgroud)

c# asp.net file-upload httppostedfile

9
推荐指数
1
解决办法
2万
查看次数

标签 统计

asp.net ×1

c# ×1

file-upload ×1

httppostedfile ×1