mvc4如何在视图中将图像转换为字节数组

时间:2013-11-04 10:49:58

标签: asp.net-mvc asp.net-mvc-4 razor

我在视图中有这个表格

@using (Html.BeginForm("AddOneImage", "ApartmentImages", FormMethod.Post))
{
    <p>
        @Html.TextBox("image", "", new { placeholder = "Uploadt New Image", type = "file"})
        <input type="submit" value="Add" />
    </p>
}

它可以工作,但它会将图像的名称发送给控制器。

我需要发送该图片的字节数组 base64

我尝试了什么

我尝试添加此标记

src="data:image;base64,@System.Convert.ToBase64String(image)

到表单,但仍然无效

0 个答案:

没有答案