Re: Upload, input type=file, submit button
- From: Randy Webb <HikksNotAtHome@xxxxxxx>
- Date: Mon, 15 May 2006 08:09:31 -0400
Larry Brown said the following on 5/15/2006 3:55 AM:
Hi,
I still have the same problem with the input type=file element, its browse button, and the submit of the form.
No, these are new issues.
I want to hide the grey old-fashioned Browse button of the input type=file with another button.
There is a reason why you are having so much trouble trying to hide the input type="file" default look. It is a security issue. If you could programatically click it, fill it out, and submit the form then you have a very huge security hole.
As for styling it, you can't.
<URL: http://www.cs.tut.fi/~jkorpela/forms/file.html#present>
When I click on this button, it simulates a click on the Browse button. This works fine.
Only in IE.
Then:
- if I use a submit button, I have to click twice on it: the first time it simply clears the input field, and the second time the form is really posted, but the result is empty (no file).
Welcome to the security issue.
- if I use a form.submit() function (which I would prefer because I have things to control before I submit the form), I get an "Access denied" error from my IE.
Don't use form.submit(), use the onsubmit handler of the form:
<form onsubmit="return checkForm()">
Then you do your things in the checkForm function and return true or false to submit the form or cancel the submission.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
.
- Follow-Ups:
- Re: Upload, input type=file, submit button
- From: Larry Brown
- Re: Upload, input type=file, submit button
- References:
- Upload, input type=file, submit button
- From: Larry Brown
- Upload, input type=file, submit button
- Prev by Date: Upload, input type=file, submit button
- Next by Date: ActiveX Windows Media Player in HTML page
- Previous by thread: Upload, input type=file, submit button
- Next by thread: Re: Upload, input type=file, submit button
- Index(es):