...

View Full Version : display an image preview when browsing for image file



wanye
10-23-2002, 06:57 AM
hi, how do i display an image preview on a page when i browse for an image file through a file field...?? is it better to do it in asp or javascript..?

glenngv
10-23-2002, 07:16 AM
<input type="file" name="f" onchange="document.images['preview'].src=this.value">
<p>Preview:<br>
<img name="preview" src="defaultPic.jpg">

you may want to check first if the file is an image or not.

wanye
10-23-2002, 09:10 AM
hi, then how do u check whether it is an image file in the first place..

glenngv
10-23-2002, 09:13 AM
check for the file extension



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum