1. 개발 중에 사용자의 첨부 파일을 업로드하는 기능이 필요할 수 있습니다. 배치 업로드 기능을 실현하기 위해 실제로 컬렉션에 여러 업로드 작업을 배치하고 별도로 업로드합니다.
2. Plupload JS 플러그인을 사용하면 매개 변수로 멀티 파일 업로드를 쉽게 구현할 수 있습니다.
3. 특정 JS 구현 방법
<script type = "text/javaScript"> var map = {}; // 파일 ID 키 및 파일 유형 값 수집 // 사용자 정의 예제 logicvar uploader = new plupload.uploader ({html5, flash, silverlight, html4 ', browse_button :'pickfiles ', // 컨텐츠에 통과 할 수 있습니다. document.getElementById ( 'container'), // ... 또는 dom 요소 자체 : '../Action/PhotouPload.jsp', flash_swf_url : '../../js/moxie.swf' ,silverlight_xap_url :'../js/moxie.xap' ,filters : {max_file_size : 5mmb ', mime _size. {제목 : "이미지 유형", 확장 : "jpg, gif, png"}]}, init : {postinit : {fortinit () {document.getElementByid ( 'uploadfiles'). onclick = function () {uploader.start (); return false;};}, foreupload : upload : upport, when upload, when upload, when upload, upload. uploader.setOption ( "multipart_params", { "apptype": $ {param.type}, "id": $ {param.id}, "filetype": map [file.id]});}, fileup 로드 : function (up, file) {$ ( "#"+file.id+"btn"). parent (). html ( "Uploaded"); $ ( "#"+file.id+"btn"). remove ();}, filesadded : function (up, files) {if ($ ( "#filetype"). val () == 1) {alert ( "첨부 파일 유형을 선택하십시오!"); // 지금 선택한 파일을 지우십시오 plupload.each (files, function (filts) {uploader.removefile (file.id);}) {map [file.id] = $ ( "#filetype"). val (); $ ( "#uploadTable"). Append ( "<tr id = '" "+file.id+"tr'> <td> "+$ ("#filetype "). val ()+"</td> <td> "+file.name+"<td> <td> id = '+file.id+"btn'onclick = del ( '"+file.id+"')> delete </button> </td> <td id = '"+file.id+"_ progress'> </td> </tr>");});});}); {$ ( "#"+ file.id+ "_ progress"). html ( '<span>'+ file.percent+ "%</span>");}, error : function (up, err) {alert ( "이 파일 업로드 실패!");}}}); uploader.init (); del (id) {uploader.removefile (id); $ ( "#"+id+"tr"). remove (); map [id] = "";} </script>다른 매개 변수는 공식 웹 사이트에 있습니다 : http://www.plupload.com/
오타쿠 프로그래머, 그의 문학적 재능은 좋지 않습니다. 피곤해 보이면 JS를 직접 복사하십시오. 다음이 있어야합니다.
<div id = "filelist"> </div> <div id = "컨테이너"> <center> 팁 : "판매자 비즈니스 라이센스", "세금 등록 증명서", "기업 신원 카드 입력", "검사 사진", "가맹점 정보 설문지"및 "상인 계약"승인을 제출해야합니다! </center><label>Attachment type:</label> <select name="fileType" id="fileType" ><option value="1">------ Please select ------</option><option value="Merchant business license">Merchant business license</option><option value="Tax registration certificate">Tax registration certificate</option><option value="Merchant information change table">Merchant information change table</option><option value = "기타"> 기타 </옵션> </select> <button id = "pickfiles"> 파일 선택 </button> <button id = "uploadfiles"> 배치 업로드 </button> <button on click = "window.location.reload ()" "> </button> <button onclick ="winde 유형 </td> <td> 파일 이름 </td> <td> 작동 </td> <td> 업로드 진행 </td> </tr> </table> </div>
위의 내용은 편집자가 Plupload 사용자 정의 매개 변수를 사용하여 멀티 파일 업로드를 달성하기 위해 소개 한 것입니다. 모든 사람에게 도움이되기를 바랍니다. 궁금한 점이 있으면 메시지를 남겨 주시면 편집자가 제 시간에 모든 사람에게 답장을 드리겠습니다. Wulin.com 웹 사이트를 지원해 주셔서 대단히 감사합니다!