在我的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)