By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,601 Members | 1,003 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,601 IT Pros & Developers. It's quick & easy.

File Upload Issue - INPUT type="file" and Use of .click()

P: n/a
HVG
Hi, does anyone know why using ".click()" on a <INPUT type="file"> control
should be a problem?

- the html file selction control is on a very plain webform page with just
the <input type="file"> control and a submit button.
- the ".click()" method is simply used to automatically open the file
selction dialog box so the user doesn't have to click "Browse". (likewise
the form is automatically submitted when the user selects a file).
The wierd effect is:
- When the user first clicks the submit button (after selecting a file),
the form does not submit, and the file selction input control clears
- If the user now selects a file again by clicking the "Browse" button
manually, the process works just fine.

So I guess the file selction control is not executing something internally
when we simulate a "Browse" button click by envoking the "click()" method.
Any ideas much appreciated.

Regards
Hugo
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies

P: n/a
Hi,

For security reasons only the user can explicitly choose files to
upload. Any manipulation to do it by code will not succeed.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)52-8888377
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2

P: n/a
HVG
Aha, that explains it.
Thanks
Hugo

"Natty Gur" <na***@dao2com.com> wrote in message
news:Op**************@tk2msftngp13.phx.gbl...
Hi,

For security reasons only the user can explicitly choose files to
upload. Any manipulation to do it by code will not succeed.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)52-8888377
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.