二进制流的存储和读取

 //上传附件
        if(file.HasFile)
        {

            UpLoadFile datam = new UpLoadFile();
            datam.FileName = file.FileName;
            datam.FileSize = file.PostedFile.ContentLength;
            datam.FileType = file.PostedFile.ContentType;
             datam.Content = file.FileBytes;
         }

//流的读取

byte[] FileRude = (byte[])upfile.Content;
        if (FileRude.Length != 0)
        {
            Response.Clear();
            HttpContext.Current.Response.ContentType = "application/octet-stream";
            HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + upfile.FileName);
            Response.BinaryWrite(FileRude);
            Response.Flush();
            Response.End();
        }

你可能感兴趣的:(存储,byte)