469,915 Members | 2,508 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

help me

I got a difficult problem about javascript. Can someone please help me?
If I use the <form> tag, and I use the <input type ="text"
name="input"> tag, I can get the value by using
document.formname.input.value , but if I am using <input
type="file" name="file"> to browse for files, how can I get its
value? Anyone who are interested to answer my question please email to
me at cy*************@gmai.com , thanks a lot.

Jul 23 '05 #1
2 1335
cy*************@gmail.com wrote:
I got a difficult problem about javascript. Can someone please help me?
If I use the <form> tag, and I use the <input type ="text"
name="input"> tag, I can get the value by using
document.formname.input.value , but if I am using <input
type="file" name="file"> to browse for files, how can I get its
value?
You can't. File inputs are security restricted.

Anyone who are interested to answer my question please email to
me at cy*************@gmai.com , thanks a lot.


No thanks. Ask in Usenet, get answered in Usenet.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #2
cy*************@gmail.com wrote:
I got a difficult problem about javascript. Can someone please help me?
If I use the <form> tag, and I use the <input type ="text"
name="input"> tag, I can get the value by using
document.formname.input.value , but if I am using <input
type="file" name="file"> to browse for files, how can I get its
value?


Exactly the same way you get the value of any form element:

<form action="">
<input type="file" name="fileSelect">
<input type="button" value="See file selected..." onclick="
alert(this.form.fileSelect.value);
">
</form>
You can't set the value or change it (other than to clear it by
resetting the form).
--
Rob
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Tom | last post: by
6 posts views Thread by wukexin | last post: by
3 posts views Thread by Colin J. Williams | last post: by
7 posts views Thread by Corepaul | last post: by
5 posts views Thread by Steve | last post: by
8 posts views Thread by Mark | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.