If you do the above method you would need to add
onsubmit="submitForm()"
to the <form> element.
- Joe
Main Topics
Browse All TopicsHello,
I'm hoping someone can help me here. I've got a form that when placed on a server running HTTPS, I get an "access denied" error in IE 6 (non-SP2 and SP-2) when a user tries to upload an image using a file upload form control.
I read something about the onClick() event handler causing it, but I've yet to see a fix or workaround for this. I've posted the form and JavaScript below.
Thanks for any help anyone can provide,
-DA
<form name="myForm" enctype="multipart/form-da
action="index.cfm?Action=P
<label for="taDescription">Descri
<br />
<textarea id="taDescription" name="description"></texta
<p />
<label for="fuFile">Photo to upload:</label>
<br />
<input id="fuFile" name="upFile" type="file" />
<br />
<input type="button" value="Send Now" onClick="submitForm()" />
</form>
<script language="JavaScript">
<!--
function submitForm()
{
if (!document.myForm.upFile.v
{
alert("Please select a file to upload.");
return false;
}
if (!document.myForm.descript
{
alert("Description is required for accessibility.");
return false;
}
document.myForm.submit();
}
// -->
</script>
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I see no error on your page, but I would rewrite it to this:
<form name="myForm" enctype="multipart/form-da
action="index.cfm?Action=P
<label for="taDescription">Descri
<br />
<textarea id="taDescription" name="description" rows="3" cols="50" ></textarea>
<p />
<label for="fuFile">Photo to upload:</label>
<br />
<input id="fuFile" name="upFile" type="file" size="40" />
<br />
<input type="submit" value="Send Now" />
</form>
<script language="JavaScript">
<!--
function checkForm(theForm){
if (theForm.upFile.value.leng
alert("Please select a file to upload.");
theForm.upFile.focus();
return false;
}
if (theForm.description.value
alert("Description is required for accessibility.");
theForm.description.focus(
return false;
}
return true;
}
// -->
</script>
Thank you very much -- worked like a charm.
One additional note, one of which I failed to note, is that we also had the following code which was causing issues:
window.onload = function() {
document.myForm.upFile.cli
}
This would open the file upload dialog window upon entering the page, but upon submitting the form, it would seem to "clear" out the contents of the file upload form control, forcing the user to re-select the image to upload. We just decided to remove this, since I'm not sure how to prevent that from happening.
Thanks again,
-Dain
Business Accounts
Answer for Membership
by: GwynforWebPosted on 2004-11-30 at 06:57:58ID: 12706351
youvan get rid of th onclick with changing th eSen Now button to
<input type="submit" value="Send Now"/>