<div class="codetitle"> <span><a style="CURSOR: pointer" data="26066" class="copybut" id="copybut26066" onclick="doCopy('code26066')"><u>코드 복사</u></a></span> 코드는 다음과 같습니다.</div> <div class="codebody" id="code26066"> <br><!DOCTYPE html PUBLIC "-//W3C/ /DTD XHTML 1.0 전환//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br><html xmlns="http://www.w3 .org/ 1999/xhtml"> <br><head> <br><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <br>< title>테스트 파일 업로드</title> <br><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js "> ;</script> <br><script 언어="javascript" type="text/javascript"> <br>$(function(){ <br>//ShowFolderFileList("D:\CodeNet\ web\ Images\shopTemplets"); <br>}); <br>function ShowFolderFileList(FilePath){ <br>var fso, f, fc, sf; <br>fso = new ActiveXObject("Scripting.FileSystemObject"); <br>try{ <br>f = fso.GetFolder(FilePath); <br>}catch(err){ <br>alert("파일 경로가 잘못되었거나 존재하지 않습니다!!"); false; <br> } <br>// 모든 파일 나열 <br>fc = new Enumerator(f.files) <br>var fileName = "" <br>for(;!fc.atEnd();fc .moveNext() ){ <br>fileName=fc.item().Name; <br>$('<div filePath="' FilePath fileName '" uploadState="wait">' FilePath fileName '</ div>') .appendTo('#showArea'); <br>} <br>// 폴더의 파일을 반복하여 읽습니다. <br>sf = new Enumerator(f.SubFolders) <br>varfolderName = ""; <br>for(;!sf.atEnd();sf.moveNext()){ <br>folderName = sf.item().Name <br>ShowFolderFileList(FilePath 폴더 이름 "/"); >} <br> } <br>function startUpload(){ <br>var s = $('#uploaddir').val().replace( /\/gi, '/' ) <br>if(s) .substring(s.length - 1 , s.length) != '/'){ <br>s = '/' <br>} <br>ShowFolderFileList(s) <br>uploadFile() <br>} <br>// 업로드 <br>function uploadFile(){ <br>if($('#showArea div[uploadState=wait]').length > 0){ <br>var thisNode = $('#showArea div[uploadState=wait ]').eq(0) <br>var WshShell=new ActiveXObject("WScript.Shell") <br>$('#fileupload').focus() <br>WshShell.SendKeys ($(thisNode) .attr('filePath')); // 중국어 경로가 없습니다 <br>uploadForm.submit() <br>$('#fileupload').focus(); ('#fileupload' ).get(0).createTextRange().select(); <br>WshShell.SendKeys('{del}') <br>var dotStr = <br>$(' <span>< ;/span>').appendTo(thisNode).css('color', 'green') <br>var uploadState = setInterval(function(){ <br>if($(thisNode). attr('uploadState' ) == 'ok'){ <br>clearInterval(uploadState) <br>$(thisNode).find('span').css('color', 'red').text(' (완료)') ; <br>uploadFile(); <br>}else{ <br>if(dotStr.length > 15){ dotStr = '.' }else{ dotStr = '.'; >$(thisNode) .find('span').text('(업로드 중' dotStr ')'); <br>} <br>}, 1000) <br>} <br>} <br>// iframe으로 반환 순환 업로드를 달성하려면 페이지에서 이 함수를 호출하세요. 그렇지 않으면 무한 루프가 됩니다. <br>function uploadFinish(){ <br>$('#showArea div[uploadState=wait]').eq(0) .attr('uploadState', 'ok') <br></script> <br><style type="text/css">body,td,th { <br>font-family: "Microsoft Yahei", Tahoma, Helvetica, Arial, 5b8b4f53, sans-serif <br></style> <br><body> 🎜>< form action="/a.html" method="post" name="loginForm" style="margin:0 0; padding:0 0;"> <br><input name="uploaddir" id="uploaddir " type="text" value="D:a" style="width:800px;" <BR><input type="button" value="Start" id="startIt" 이름 ="startIt" onclick="javascript:startUpload();"/> <br></form> <br><form action="/index/upload" method="post" name="uploadForm" enctype ="multipart/ form-data" target="hidden_frame"> <br><input type="file" name="fileupload" id="fileupload" /><br><iframe name='hidden_frame' id="hidden_frame" style='display:none'></iframe> <br></iframe> <br><div id="showArea"> ></ div> <br></body> <br></html><br><br> </div>