개발하다가 남기면 좋을것 같아서 남겨 봅니다^^
먼저 아래 코드를 넣어서 file type을 0으로 줄인다.
<style>
#file { width:0; height:0; }
</style>
<script>
$j(function(){
$j('#btn-upload').click(function(e){
e.preventDefault();
$j("input:file").click();
var ext = $j("input:file").val().split(".").pop().toLowerCase();
if($j.inArray(ext, ["gif","png","jpg","jpeg"]) == -1) {
alert("gif,png,jpg 파일만 업로드 할수 있습니다.");
return false;
}
$j("input:file").val().toLowerCase();
});
});
</script>
그리고 html내에
<input type='file' id='file' name='file' />
<button id='btn-upload' class="button1 white selected" onfocus="this.blur();">사업자등록증 첨부</button>
이렇게 해주면 깔금하게 버튼 하나로만 처리되어집니다.
버튼에는 css로 이쁘게 처리하면 되거나 이미지로 입혀도 되겠죠?
생각하는 개발자의 세상 웹디넷이었습니다.(http://www.webdy.net)
게시글 목록
| 번호 | 제목 |
|---|---|
| 11348 |
정규표현식
정규식 표현법
|
| 11346 |
웹서버
리눅스 기본 명령어
1
|
| 11345 |
jQuery
ajax 예제 입니다.
|
| 11336 |
jQuery
jQuery Performance
8
|
| 11332 |
jQuery
jQuery Event - 이벤트에 생명을~
3
|
| 11329 |
jQuery
jQuery Event - bind() 메서드
2
|
| 11326 |
jQuery
jQuery Event - 이벤트 지원 메서드
2
|
| 11324 | |
| 11323 | |
| 11321 | |
| 11320 |
jQuery
jQuery Core
|
| 11319 | |
| 11318 |
jQuery
jQuery Traverse - Filtering
|
| 11317 | |
| 11316 | |
| 11315 | |
| 11314 | |
| 11313 | |
| 11312 | |
| 11311 | |
| 11310 | |
| 11308 | |
| 11304 |
JavaScript
주소표시
3
|
| 20200 |
CSS
CSS 자료 링크
4
|
| 11300 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기