개

swf오픈소스을 이용한 업로드 간단설명~(확장자 구분)

· 2010-12-08 (수) 10:15:03 · 5063
엑티브 을 이용하여 업로드에서 일본쪽에서 엑티브 사용안한다고

swf오픈 소스을 이용하여 업로드구현

단 zip 파일만 업로드



기본적인것만 작성했음~



1. 오픈swf업로드 이용

2. zip 파일만 허용





http://swfupload.org/ <= swf업로드 다운받는 사이트 ~







css : swfupload 의 css부분

images : swfupload 의 버튼이미지

js : fileprogress.js : 진행바및 상태창 관련

handlers.js : 화면에 출력되거나 파일이 아니거나 하는 alert 창 메세지을 제어하는 스크립트

swfupload : 이 부분은 손을 만지지 않았다



===================

mediaupload.jsp



<html>
<head>
<title>:: test ::</title>

<!-- 업로드 스크립트 경로지정-->
<link href="./css/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=strCommonPath%>/media/swfupload/swfupload.js"></script>
<script type="text/javascript" src="<%=strCommonPath%>/media/swfupload/swfupload.queue.js"></script>
<script type="text/javascript" src="<%=strCommonPath%>/media/js/fileprogress.js"></script> <!-- 진행바및 상태창 관련 -->
<script type="text/javascript" src="<%=strCommonPath%>/media/js/handlers.js"></script> <!-- 이벤트 관련 -->
<script type="text/javascript">

var swfu;

window.onload = function() {
var settings = {

flash_url : "/mydocuhut/common/media/swfupload/swfupload.swf",
flash9_url : "/mydocuhut/common/media/swfupload/swfupload_fp9.swf",
upload_url: "jp/mediaup", //해당액션부분지정 <= 난 jp/mediaup 이란 서블릿명을 지정
//post_params: {"param0" : "teos"}, //파일 이외의 파라미터를 보낼때

//이부분은 기본적으로 바뀌지 않는 고정값등을 이부분에서 넣어줄수 있다.
post_params: {"upkind" : document.upFrm.upkind.value
, "idxnum" : "3"

},
file_size_limit : "5120 MB",
file_types : "*.zip", //이부분에 업로드할 확장자을 지정할 수 있다.
file_types_description : "All Files",
//file_types : "*.jpg;*.gif;*.png;*.jpeg",
//file_types_description : "jpg, gif, png, jpeg",//"All Files",
file_upload_limit :1, //최대 첨부 파일 수
file_queue_limit : 0,
custom_settings : {
progressTarget : "fsUploadProgress", //body부분에서 뿌려질 id명이다.
cancelButtonId : "btnCancel"
},
debug: false, //true일경우 debug창이 열린다.

// 버튼 셋팅
button_width: "80",
button_height: "22",
button_placeholder_id: "spanButtonPlaceHolder", //플레쉬로 교체될 DOM 엘리먼트
button_image_url: "/mydocuhut/common/media/images/searchbutton.gif", //플레쉬로 보여줄 버튼 이미지

//button_text: '<span class="theFont">파일찾기..</span>',
//button_text_style: ".theFont { background-color:red; font-size:13px; }",
//button_text_left_padding: 12,
//button_text_top_padding: 3,

button_action : SWFUpload.BUTTON_ACTION.SELECT_FILES,
button_disabled : false,
button_cursor : SWFUpload.CURSOR.HAND,
button_window_mode : SWFUpload.WINDOW_MODE.TRANSPARENT


// The event handler functions are defined in handlers.js

,swfupload_preload_handler : preLoad
,swfupload_load_failed_handler : loadFailed

,file_queued_handler : fileQueued //파일을 선택후 목록에 올린다.
,file_queue_error_handler : fileQueueError
,file_dialog_complete_handler : fileDialogComplete //전송 시작

,upload_start_handler : uploadStart //upload 시작?을때
,upload_progress_handler : uploadProgress
,upload_error_handler : uploadError
,upload_success_handler : uploadSuccess
,upload_complete_handler : uploadComplete
,queue_complete_handler : queueComplete // Queue plugin event

};

swfu = new SWFUpload(settings);

};

// 업로드 시작
function fileDialogComplete_mn() {
try {
/*

업로드 전에 이벤트는 이부분에 입력

널값 체크 등등

*/

//추가 파라미터나 업로드시 넘길 파라미터을 지정
swfu.addPostParam("media_title",document.upFrm.media_title.value);
swfu.startUpload(); //업로드
} catch (ex) {
swfu.debug(ex);
}
}
</script>
<!-- 업로드 스크립트 끝 -->

<body>



<form name="upFrm" action="jp/mediaup" method="post" encType="multipart/form-data">
<table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>
<td height="25" align="center" bgcolor="#E8E8E8" class="gray"><strong>제목
<font color="red"><sup>*</sup></font>
</strong></td>
<td> </td>
<td><input size="40" type="text" name="media_title" style="border : 1 solid #6b6b6b; width:270px; height:20px"></td>
</tr>

<tr>

<div id="divStatus"> - 0 Files Uploaded <!-- handlers.js 에서 컨트롤 한다. --></div>
<div class="fieldset flash" id="fsUploadProgress">
<span class="legend">업로드파일</span>
</div> //업로드 파일명 및 flash바 상태을 화면에 출력하는 부분

<span id="spanButtonPlaceHolder"></span> //찾아보기 버튼불러오기



<td height="20" align="center" background="<%=strLangPath%>/img1/bg3.gif" align="center" valign="center" colspan="3">
<input id="btnSubmit" type="button" value="업로드" onclick="fileDialogComplete_mn();" style="margin-center: 2px; font-size: 8pt; height: 20px;" />
<input id="btnCancel" type="button" value="닫기" onclick="javascript:self.close()" style="margin-center: 2px; font-size: 8pt; height: 20px;" />
</td>

</tr>

</table>

</form>

</body>

</html><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:16:08 PHP & HTML에서 이동 됨]</div>
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

8,188건
+
제목 글쓴이 날짜 조회
11-10-25 조회 2,486
11-10-18 조회 4,016
11-10-18 조회 2,392
11-10-15 조회 3,614
11-10-10 조회 2,665
11-10-02 조회 2,582
11-09-28 조회 2,396
11-09-24 조회 2,483
11-09-22 조회 2,381
11-09-05 조회 2,869
11-08-31 조회 2,245
11-08-31 조회 2,554
11-08-31 조회 2,409
11-08-29 조회 2,959
11-08-28 조회 2,453
11-08-25 조회 2,504
11-08-17 조회 2,218
11-08-16 조회 2,454
11-08-11 조회 2,907
11-08-07 조회 2,619
11-08-03 조회 2,328
11-07-22 조회 2,080
11-07-12 조회 3,299
11-06-27 조회 2,079
11-06-01 조회 1,745
11-05-17 조회 2,534
11-05-01 조회 2,604
11-04-28 조회 2,891
11-04-28 조회 2,938
11-04-13 조회 2,599
11-03-27 조회 2,719
11-03-27 조회 2,599
11-03-14 조회 2,012
11-03-02 조회 2,336
11-03-02 조회 2,566
11-02-27 조회 2,996
11-02-23 조회 2,375
11-02-19 조회 2,517
11-02-14 조회 4,132
11-02-03 조회 2,924
11-01-24 조회 3,865
11-01-04 조회 2,397
10-12-08 조회 5,404
10-11-15 조회 2,409
10-11-14 조회 2,587
10-11-14 조회 3,611
10-10-29 조회 3,681
10-10-19 조회 2,695
10-10-07 조회 2,522
10-10-05 조회 4,439
10-09-18 조회 2,739
10-09-18 조회 2,478
10-09-17 조회 4,880
10-09-15 조회 2,823
10-09-15 조회 2,347
10-09-15 조회 2,837
10-09-15 조회 2,671
10-09-11 조회 3,994
10-09-11 조회 2,502
10-09-11 조회 2,540
10-09-07 조회 3,815
10-09-07 조회 3,351
10-08-29 조회 2,807
10-07-01 조회 3,060
10-06-30 조회 2,462
10-06-30 조회 2,648
10-06-30 조회 2,999
10-06-13 조회 2,032
10-04-15 조회 3,203
10-04-04 조회 3,433
10-02-23 조회 3,531
10-02-09 조회 3,135
10-01-25 조회 2,642
10-01-25 조회 2,736
09-12-27 조회 4,389
09-11-23 조회 3,610
09-11-20 조회 4,843
09-08-30 조회 3,046
09-08-30 조회 3,041
09-08-12 조회 3,008
09-07-22 조회 4,067
09-07-22 조회 4,717
09-07-15 조회 5,886
09-07-11 조회 2,961
09-06-17 조회 2,700
09-06-15 조회 2,990
09-05-29 조회 3,269
09-05-11 조회 5,907
09-05-08 조회 2,659
09-04-30 조회 3,780
09-04-17 조회 3,095
09-04-04 조회 3,274
09-03-05 조회 3,663
09-02-09 조회 3,631
09-02-03 조회 6,140
08-12-27 조회 3,201
08-12-20 조회 4,292
08-11-21 조회 5,252
08-11-14 조회 2,820
08-11-03 조회 3,281