当前位置: 代码迷 >> ASP >> asp.net mvc下传文件取流
  详细解决方案

asp.net mvc下传文件取流

热度:394   发布时间:2012-11-05 09:35:12.0
asp.net mvc上传文件取流

% using (Html.BeginForm("AutoUpLoadForQuotitGetPostFile", "ReleaseManager",FormMethod.Post,new {enctype="multipart/form-data"}))

 要给form的entype属性设为:enctype="multipart/form-data

后台方法:

//www.52mvc.com 

using (var fileStream = Request.Files[0].InputStream)
                {
                    int fileLength = (int)fileStream.Length;
                    fileStream.Position = 0;
                    byte[] fileArray = new byte[fileLength];
                    fileStream.Read(fileArray, 0, fileLength);
                }


  相关解决方案