469,935 Members | 1,609 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

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

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
2 1954
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
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.

Similar topics

5 posts views Thread by Mr Gordonz | last post: by
4 posts views Thread by sakurasyi | last post: by
4 posts views Thread by Petr Vileta | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.