hai everybody am using following code to preview the image before uploading it. but am unable to display the image please help me.

<SCRIPT type="text/javascript">

function preview(what){
	document.getElementById("previewField").src=what.value;
}
</SCRIPT>


	<INPUT type="file" id="picField" onchange="preview(this)">
	<IMG id="previewField" alt="Preview">

thank you.

Recommended Answers

All 3 Replies

JavaScript is not JSP(Java Server Pages). Please take care where you post your questions.

Post moved

hai everybody am using following code to preview the image before uploading it. but am unable to display the image please help me.

<SCRIPT type="text/javascript">

function preview(what){
	document.getElementById("previewField").src=what.value;
}
</SCRIPT>


	<INPUT type="file" id="picField" onchange="preview(this)">
	<IMG id="previewField" alt="Preview">

thank you.

Image preview before upload, is possible (up until now) only on Explorer UAs.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.