Created
November 23, 2015 10:29
-
-
Save arahansa/e39a231b9a74ebeb722d to your computer and use it in GitHub Desktop.
이미지 업로드 테스트
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html ng-app="app"> | |
<head> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script> | |
</head> | |
<body> | |
<input type="file" id="testForm" /> | |
<br><br> | |
<img id="test" src=""> | |
<br><br> | |
<span class="mypage_user_img"></span> | |
<script> | |
$('#testForm').on('change', function() { | |
var reader = new FileReader(); | |
reader.readAsDataURL(this.files[0]); | |
reader.onload= function (e){ | |
$("#test").attr("src", e.target.result); | |
/*$('.mypage_user_img').html('<img src="'+e.target.result+'" />');*/ | |
} | |
/* | |
$("#test").attr("src", e.target.result); | |
*/ | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment