2012-09-04 2 views
0

MVC 3 면도기에서 작업 중입니다. 전체 page.My 코드를 새로 고치지 않고 파일을 업로드하는 방법은 아래에있는 내 문제는 내가() 위에서 언급 한 Html.BeginForm 내 행동과 컨트롤러를 정의 할 수 있다는 것입니다mvc 면도기에서 전체 페이지를 새로 고치지 않고 파일 업로드

@using (Html.BeginForm()) 
    { 
     <input type='file' name='file' id='file' /> 
     <input type="Button" value="upload" /> 
    } 

을 언급했다. 업로드 단추를 클릭하면 controller.how의 동작으로 이동하여 업로드 된 파일을 view에서 controller.please로 전달합니다. 데모 샘플을 사용할 수 있다면 내 시나리오대로 공유하겠습니다.

답변

0

확인이 코드,

@using (Html.BeginForm("FileUploadss", "Controller", FormMethod.Post, 
            new {enctype ="multipart/form-data"})) 
{ 
     <input type='file' name='file' id='file' /> 
     <input type="submit" value="upload" /> 
} 

이동, 컨트롤러를 통해 UR하고이 코드를 사용하는

public ActionResult FileUploadss(HttpPostedFileBase file) 
    { 
     if(file.ContentLength>0) 
      { 
      } 
    } 
관련 문제