Click here to Skip to main content
14,638,198 members
Rate this:
Please Sign up or sign in to vote.
See more:
i am using wizard in .
i have image upload on all steps
for display image i am using this script shown below
<script type="text/javascript">
        function previewFile() {
            var preview = document.querySelector('#<%=ImgFmlyPhoto.ClientID %>');
            var file = document.querySelector('#<%=FUFmlymbr.ClientID %>').files[0];
            var reader = new FileReader();

            reader.onloadend = function () {
                preview.src = reader.result;

            if (file) {

            } else {
                preview.src = "";

<asp:FileUpload ID="FUFmlymbr" runat="server" onchange="previewFile()" type="file" name="file"/>

problem is when i browse image on step1 picture is displayed but when i go to step 2 and again i come to step 1 so there is no image.

please help .............
Updated 16-Sep-14 2:01am
Member 11014751 15-Sep-14 5:52am
Any One please Help
ZurdoDev 15-Sep-14 8:09am
This does not make much sense. You'll have to debug it and find out exactly what is happening.
Rate this:
Please Sign up or sign in to vote.

Solution 1

Rate this:
Please Sign up or sign in to vote.

Solution 2

Use the Sample Code as :

<html xmlns="">
<title>jQuery Preview Image before upload</title>
<script type="text/javascript" src=""></script>
<script type="text/javascript">
function Preview(input) {
if (input.files && input.files[0]) {
var filerdr = new FileReader();
filerdr.onload = function(e) {
<form id="form1" runat="server">
<input type="file" name="filUpload" id="filUpload" onchange="Preview(this)" />

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100