Forum Moderators: open

Message Too Old, No Replies

file.click() do not work

         

Xuefer

3:13 pm on Nov 16, 2004 (gmt 0)

10+ Year Member



code:

<form method="post" enctype="multipart/form-data">
<input type="file" name="file">
<input type="button" onclick="document.getElementById('file').click()" value="click me">
<input type="submit" value="Submit">
</form>

click button to select a file, it's ok.
but press Submit will clear file input, no submit
must press again will submit, but no file uploaded

almost same problem as [experts-exchange.com...]
but i need the real file uploaded

system: winxp sp2
browser: ie6 (come with sp2)
gmail js: works
my code: failed :(

any idea?

iamlost

12:00 am on Nov 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Do you not need action="<HTTP URI>"?

I believe it is a required attribute.

[url]http://www.w3.org/TR/REC-html40/interact/forms.html[/url

Xuefer

3:04 pm on Nov 17, 2004 (gmt 0)

10+ Year Member



that was just an example

here we go:

<form method="post" enctype="multipart/form-data" action="about:blank" onsubmit="alert(this.elements.file.value); return true">

u can try action="abc.php" for testing
all with same result

Xuefer

7:20 am on Nov 20, 2004 (gmt 0)

10+ Year Member



shall this thread move to javascript?