2013-06-19 2 views
0

추가 입력 (jQuery를 사용하여) 페이지를 다시로드 withour MVC4보기 버튼을 클릭

버튼 "다음 파일 추가"를 클릭 한 후이 동적으로 (보기 모델)보기로 <input type="file" name="files" id="file[i]" /> 을 추가 할 수있는 가능성이 http://haacked.com/archive/2010/07/16/uploading-files-with-aspnetmvc.aspx를 통해, 후?

다음은 주요 코드입니다.

<form action="" method="post" enctype="multipart/form-data"> 

    <label for="file1">Filename:</label> 
    <input type="file" name="files" id="file1" /> 

    <label for="file2">Filename:</label> 
    <input type="file" name="files" id="file2" /> 

    <input type="submit" /> 
</form> 

감사

+0

매번 새로운 파일 입력을 생성하는 대신 멀티 업로드 이미지 jquery 플러그인을 사용하고 사용자가 한 번에 하나의 파일을 업로드하도록하는 이유는 무엇입니까? – bipen

+0

하지만 사용하지 않아도되는 경우는 무엇입니까? jquery 플러그인을 멀티 업로드 하시겠습니까? :) 단지 5 또는 6 또는 7 개의 파일을 업로드하면됩니다. – whoah

+0

그때의 벌금 ... 나는 생각했다. 사용자가 20 개의 파일을 업로드해야한다면 .... 20 개의 입력과 20 개의 시간 업로드 .. phewww !!! .. :) :) – bipen

답변

2

을 당신은 JQuery와 여러 파일 업로드 당신이 JQuery와 당신의 논리 개까지 적절한

$('#Maindiv').append("<label for="file1">Filename:</label><input type="file" name="files" id="file1" />"); 

세트 ID를 사용할 수있는보기 here.

우리를 plugin.Take 사용할 수 있습니다.

관련 문제