您的位置:首页 > 其它

vs2013 上传碰到的问题:“输入的不是有效的 Base-64 字符串 ”

2013-11-07 17:49 429 查看
action 代码:

@using (Html.BeginForm("Create", "ImageStore", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.AntiForgeryToken()

<div class="form-horizontal">
<h4>ImageStoreModels</h4>
<hr />
@Html.ValidationSummary(true)

<div class="form-group">
@Html.LabelFor(model => model.ImageCataloge, new { @class = "control-label col-md-2" })
<div class="col-md-10">

@Html.DropDownListForEnum(model => model.ImageCataloge)
@Html.ValidationMessageFor(model => model.ImageCataloge)
</div>
</div>

<div class="form-group">
@Html.LabelFor(model => model.ImageData, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@*@Html.TextBoxFor(model => model.ImageData, new { type = "file",  style="none"})*@

<input name="ImageData" type="file"  />
@Html.ValidationMessageFor(model => model.ImageData)

<input name="ImageData" id="ImageData" type="file" />
</div>
</div>

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

<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
}


View 代码
提交图片, 上传的时候,总是报: 输入的不是有效的 Base-64 字符串    的错误。

后来,在网上才找到答案:
http://stackoverflow.com/questions/3294023/input-file-autobind-to-byte-aray-in-asp-net-mvc
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐