View Full Version : display an image preview when browsing for image file
wanye
10-23-2002, 05: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, 06: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, 08:10 AM
hi, then how do u check whether it is an image file in the first place..
glenngv
10-23-2002, 08:13 AM
check for the file extension
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.