왜 파일 입력이 2 개입니까? 왜 2 가지 서식이 있습니까?
[HttpPost]
public ActionResult Create(lm_pics lm_pics, HttpPostedFileBase file)
{
...
}
: 양식 제출을 처리 할 첫 번째 (당신이 그것을하지 않고 파일을 업로드 할 수 없습니다 당신이 그것에
enctype="multipart/form-data"
속성을 추가 물론 가정) 충분한 형태?
@model PictureUploader_MVC.Models.lm_pics
@{
ViewBag.Title = "Create";
}
<h2>Upload Picture</h2>
@using (Html.BeginForm(null, null, FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.ValidationSummary(true)
<fieldset>
<legend>lmit_pics</legend>
<div class="editor-label">
@Html.LabelFor(model => model.brand)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.brand)
@Html.ValidationMessageFor(model => model.brand)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.enabled)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.enabled)
@Html.ValidationMessageFor(model => model.enabled)
</div>
<div>
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
</div>
</fieldset>
<button type="submit">Create</button>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
및 컨트롤러 동작하지 않습니다
현재보기의 모양을 보여줄 수 있습니까? –