Skip to content

Instantly share code, notes, and snippets.

@rushdimohamed09
Created April 21, 2016 15:27
Show Gist options
  • Save rushdimohamed09/81cc0fe94b9078f7781cb359b49d583d to your computer and use it in GitHub Desktop.
Save rushdimohamed09/81cc0fe94b9078f7781cb359b49d583d to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<script>
function readURL(input)
{
if (input.files && input.files[0])
{
var reader = new FileReader();
reader.onload = function (e)
{
$('#blah').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
$("#imgInp").change(function()
{
readURL(this);
});
function readURL(input)
{
if (input.files && input.files[0])
{
var reader = new FileReader();
reader.onload = function (e)
{
$('#blah1').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
$("#imgInp1").change(function()
{
readURL(this);
});
</script>
</head>
<body>
<form id="form1" runat="server">
<input type='file' id="imgInp" />
<img id="blah" src="#" alt="your image" width="250" height="250" /><br>
<input type='file' id="imgInp1" />
<img id="blah1" src="#" alt="your image" width="250" height="250" />
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment