"Access Denied" submitting form with Javascript?

N

Noozer

The following javascript code generates an "Access denied" error at the
indicated line.

This sample should allow the user to click "Browse" and choose a file. Once
the user has selected a file the form is automatically submitted. I'm trying
to avoid having seperate browse and submit actions.

Can someone explain why I'm getting the error and how I can accomplish this
task?

Thx!

<html>
<head></head>

<body>

<form name="form1" id="form1" method="post" action="test.htm">
<input type="button" value="Browse" onclick="return vlu();">
</form>

<form name="form2" id="form2" method="post" action="test.htm"
style="display:none;">
<input type="file" name="file1" id="file1">
</form>

<script language="javascript"> <!--
function vlu() {
form2.file1.click();
if (form2.file1.value != "") {
form2.submit(); //*** ERROR HERE
}
}
//-->
</script>
</body>
</html>
 
L

Lee

Noozer said:
The following javascript code generates an "Access denied" error at the
indicated line.

This sample should allow the user to click "Browse" and choose a file. Once
the user has selected a file the form is automatically submitted. I'm trying
to avoid having seperate browse and submit actions.

Besides the security issue, what if I just accidentally release
the mouse button over the wrong file? You don't want to make it
too easy to make a potentially serious mistake.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top