469,333 Members | 4,490 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,333 developers. It's quick & easy.

can't read value from <input type=file> in netscape

Hello,

I have <input type=file id=myfile> in a form.
In IE I can read the value thusly:

document.getElementById("myfile").value

But thusly returns "" in Mozilla/Netscape.

I also tried through the DOM but

node.value was ""
node.text was ""

Can I not read this value in Moz/NS?

Oct 29 '05 #1
1 2273
my*****@yahoo.ca said the following on 10/29/2005 3:54 PM:
Hello,

I have <input type=file id=myfile> in a form.
In IE I can read the value thusly:

document.getElementById("myfile").value

But thusly returns "" in Mozilla/Netscape.

I also tried through the DOM but

node.value was ""
node.text was ""

Can I not read this value in Moz/NS?


Yes, you use a name attribute and the forms collection:

<script type="text/javascript">
function getValue(formRef){
alert(formRef.fileInput.value)
}
</script>

<form name="myForm">
<input type="file" onchange="alert(this.value)" name="fileInput"><br />
<input type="button" value="Get The Value"
onclick="getValue(this.form)">

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Oct 29 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.