This is a migrated thread and some comments may be shown as answers.

How to preview image before upload

1 Answer 91 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Henry John
Top achievements
Rank 1
Henry John asked on 12 May 2010, 04:48 AM
I have tried to preview image before upload but i cannot. i also use code in document but still not.
This Code:

<

 

script type="text/javascript">

 

 

function OnClientFileSelectedHandler(sender, eventArgs)

 

{

 

debugger;

 

 

var input = eventArgs.get_fileInputField();

 

 

//check the extension

 

 

if (sender.isExtensionValid(input.value))

 

{

 

var img = document.getElementById('<%= imgAttach.ClientID %>');

 

 

if (img)

 

{

img.style.visibility =

"";

 

img.src = eventArgs.get_fileInputField().value;

}

}

}

 

</script>
Please hepl me and if can send me a example about this.Thanks

 

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 12 May 2010, 06:31 AM

Hi,

The limitation of above code is, it will work correctly on IE browser only, since in Firefox the input.value returns the filename instead of the full path to the file. For security reasons the code will work only on localhost, to make it work remotely you need to add the site to the Trusted Sites.

Please check the Limitations part of this help article.

.

.

Also go through the following forum link which discusses a similar scenario.

Preview in Rad Upload

-Shinu.

Tags
Upload (Obsolete)
Asked by
Henry John
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or