使用LINQ上传图像

时间:2017-01-08 18:09:36

标签: c# linq image-uploading

我正在尝试将图像上传到数据库。我的代码如下:

我收到以下错误:

  

输入不是有效的Base-64字符串,因为它包含非基数64   字符,两个以上的填充字符或非法字符   在填充字符中。

我怎样才能让它发挥作用?

查看

 Threading.Thread.Sleep(10000)

MODEL

    <div class="form-group">
        @Html.LabelFor(model => model.image, new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.TextBoxFor(model => model.image, new { @class = "form-control", type = "file", placeholder = "image" })
            @Html.ValidationMessageFor(model => model.image)
        </div>
    </div>

CONTROLLER

namespace MyPro.Models
{
    using System;
    using System.Collections.Generic;

    public partial class Profile
    { 
         ...
         public byte[] image{ get; set; }
    }
}

数据库图片:

enter image description here

0 个答案:

没有答案