Click here to Skip to main content
15,877,859 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.

Share this answer
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)" />
Share this answer

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900