Home All Groups Group Topic Archive Search About

How to get the file's name after click the Browse... in HtmlInputFile

Author
25 Apr 2005 8:20 AM
Kylin
click the Browse... button,
and choose a image from local disk,OK.
and how to show the image in the webpage .
before it be uploaded ?

--
FireCrow Studio
Kylin Garden
EMail:w***@sohu.com
ICQ:156134382

Author
4 May 2005 8:01 PM
Munsifali Rashid
Add an image to your page, and change it's src property to the value in the
file input box.

Eg.

<img name="preview" src="blank.gif">
<input name="newImage" type="file">
<input type="button" onClick="previewImage()">

<script language="javascript">
<!--
function previewImage()
{
var filename = document.forms[0].elements["newImage"].value;
var img = document.all.preview;
img.src = filename;
}
//-->
</script>

This code hasn't been tested, and might need some modification, but it
should give you an idea of what you need to do.

Mun

--
Munsifali Rashid
http://www.munit.co.uk/blog/



Show quoteHide quote
"Kylin" <w***@sohu.com> wrote in message
news:udPFb%23WSFHA.1096@tk2msftngp13.phx.gbl...
> click the Browse... button,
> and choose a image from local disk,OK.
> and how to show the image in the webpage .
> before it be uploaded ?
>
> --
> FireCrow Studio
> Kylin Garden
> EMail:w***@sohu.com
> ICQ:156134382
>
>