<script type="text/javascript">
function chkform(form)
{
// image preview
function readURL(input)
{
if (input.files && input.files[0])
{
var reader = new FileReader();
reader.onload = function (e) {
document.getElementById('preview').src=e.target.result;
}
reader.readAsDataURL(input.files[0]);
}
}
</script>
<form name="f2" method="post" enctype="multipart/form-data" style=" margin-top: -100px;" onsubmit="return chkform(this);">
<<input type="file" name="file" id="imgfile" onchange="readURL(this)";/>
<img id="preview" src="#" alt="your image" />
</form>
function chkform(form)
{
// image preview
function readURL(input)
{
if (input.files && input.files[0])
{
var reader = new FileReader();
reader.onload = function (e) {
document.getElementById('preview').src=e.target.result;
}
reader.readAsDataURL(input.files[0]);
}
}
</script>
<form name="f2" method="post" enctype="multipart/form-data" style=" margin-top: -100px;" onsubmit="return chkform(this);">
<<input type="file" name="file" id="imgfile" onchange="readURL(this)";/>
<img id="preview" src="#" alt="your image" />
</form>
No comments:
Post a Comment