Skip to content

Instantly share code, notes, and snippets.

@arahansa
Created November 23, 2015 10:29
Show Gist options
  • Save arahansa/e39a231b9a74ebeb722d to your computer and use it in GitHub Desktop.
Save arahansa/e39a231b9a74ebeb722d to your computer and use it in GitHub Desktop.
이미지 업로드 테스트
<!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