相关疑难解决方法(0)

将HttpPostedFileBase转换为byte []

在我的MVC应用程序中,我使用以下代码上传文件.

模型

 public HttpPostedFileBase File { get; set; }
Run Code Online (Sandbox Code Playgroud)

视图

@Html.TextBoxFor(m => m.File, new { type = "file" })
Run Code Online (Sandbox Code Playgroud)

一切工作正常..但我试图将结果fiel转换为byte [].我怎么能这样做

CONTROLLER

 public ActionResult ManagePhotos(ManagePhotos model)
    {
        if (ModelState.IsValid)
        {
            byte[] image = model.File; //Its not working .How can convert this to byte array
        }
     }
Run Code Online (Sandbox Code Playgroud)

arrays image asp.net-mvc-3

116
推荐指数
2
解决办法
10万
查看次数

标签 统计

arrays ×1

asp.net-mvc-3 ×1

image ×1