51 lines
2.4 KiB
HTML
51 lines
2.4 KiB
HTML
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<link rel="stylesheet" href="../innorix.css">
|
|
<script src="../innorix.js"></script>
|
|
<script>
|
|
var control = new Object();
|
|
window.onload = function() {
|
|
// 파일전송 컨트롤 생성
|
|
control = innorix.create({
|
|
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
|
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
|
installUrl: '../install/install.html', // Agent 설치 페이지
|
|
allowExtension: { "Pdf files (*.pdf)" : ["pdf"] }, // 정의된 확장자 파일만 추가
|
|
uploadUrl: './uploadServerDirChangeName.jsp' // 업로드 URL
|
|
});
|
|
|
|
// 업로드 완료 이벤트
|
|
control.on('uploadComplete', function (p) {
|
|
console.log(p.files);
|
|
var f = p.files;
|
|
var r = "Upload complete\n\n";
|
|
for (var i = 0; i < f.length; i++ ) {
|
|
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
|
|
|
console.log('실제 파일명 : '+f[i].clientFileName);
|
|
console.log('서버 업로드 경로 : '+f[i].serverFilePath);
|
|
console.log('서버 저장 파일명 : '+f[i].serverFileName);
|
|
}
|
|
alert(r);
|
|
});
|
|
|
|
// 파일 첨부 에러
|
|
control.on('addFileError', function (p) {
|
|
alert(p[0].type+"\n"+p[0].message);
|
|
});
|
|
};
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
|
<p>pdf파일만 첨부할 수 있게 설정되어 있고, 서버의 /data 하위에 UUID폴더를 생성하고 UUID이름으로 파일명을 변경하는 예제입니다.</p>
|
|
|
|
<div id="fileControl"></div><br/>
|
|
|
|
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
|
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
|
<input type="button" value="업로드" onclick="control.upload();"/>
|
|
</body>
|
|
</html> |