using System.IO;
private byte[] FillPlanarGraph(FileUpload fileUpload)
{
//得到提交的文件
Stream fileDataStream = fileUpload.PostedFile.InputStream;
//得到文件大小
int fileLength = fileUpload.PostedFile.ContentLength;
//创建数组
byte[] curImg = new byte[fileLength];
//把文件流填充到数组
fileDataStream.Read(curImg, 0, fileLength);
//得到文件名字
string fileTitle = FileUpload1.Value;
//得到文件类型
string fileType = FileUpPlanar.PostedFile.ContentType;
return curImg;
}
本文介绍了一种从HTTP文件上传中读取数据的方法。通过使用.NET框架提供的类,文章详细展示了如何将上传的文件流转换为字节数组,以便于进一步处理或存储。此过程包括获取文件流、确定文件大小、创建字节数组并填充数据。
1680

被折叠的 条评论
为什么被折叠?



