내보기 - UploadDocument를 표시 할 색상 상자 팝업이 있습니다. 이 뷰에서 파일 업로드 요소 (type = "file") 및 텍스트 상자가 있습니다. 내보기에양식 태그가없는 MVC 파일 업로드
<h4 class="resume">Upload a document to presentation </h4>
<div class="description">Please click on the link below to add documents to your presentation.</div>
<table id="fieldsTable" class="tblFields">
<tr>
<td class="description">Choose file:</td>
<td> <input id="fileDialog" type="file" name="file"/></td>
</tr>
<tr>
<td class="description">Description:</td>
<td> <input type="text" id="docFileName" style="width: 225px;"/></td>
</tr>
<tr>
<td colspan="2" width="300px"><span class="errorMessage" id="spanErrorMessage"></span></td>
</tr>
</table>
내가 저장 버튼의 클릭에 컨트롤러 액션의 포스트 메소드를 호출하고 - 여기
는parent.parent.$.fn.colorbox({
href: url + '?callingWindow=' + window.frameElement.id,
open: true,
iframe: true,
width: "450px",
height: "300px",
title: "Upload Document",
close: '<button id=\"Save\">Save</button><button id=\"Cancel\">Cancel</button>',
onClosed: false
});
UploadDocument보기는 colorbox-
코드입니다.이제 HttpPostedFileBase를 사용하여 작업 메서드 UploadDocument를 매개 변수로 호출합니다. 항상 null입니다.
이것이 작동하려면 태그가 있어야하고 입력 = 제출해야합니까? 저장 단추가보기의 일부가 아니기 때문에 여기서는 할 수 없지만 부모는 기본 단추를 클릭하고 양식 태그없이이 작업을 수행 할 수있는 대안이 있습니까?
양식 태그없이 파일을 업로드하는 것은 불가능합니다 .. – dotNETbeginner
양식 및 제출 버튼을 차단하는 이유는 무엇입니까? – dotNETbeginner
저장 단추가 색상 상자의 일부이며 뷰가 아닌 경우. 내보기에 버튼이 있다면 훨씬 쉬울 것입니다. –