p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Javascript How-To (http://p2p.wrox.com/forumdisplay.php?f=87)
-   -   Why the form refuse access? (http://p2p.wrox.com/showthread.php?t=26901)

shenliujun March 15th, 2005 10:11 PM

Why the form refuse access?
I want to upload file ,but not use <input id='upfile' type='file'>.I use a button to fire the upfile control's click event.But when I submit form. The error infomation is "The form refuse access".Why? Who give me a correct solution with javascript ?
//script is
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
        <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
        <meta content="JavaScript" name="vs_defaultClientScript">
        <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
        <script language="javascript">
        function clkHandler(){
           document.Form1.submit(); //error is here
    <body MS_POSITIONING="GridLayout" >
        <form id="Form2" method="post" runat="server" enctype="multipart/form-data">
            <INPUT id="btn1" onclick="clkHandler();" type="button" value="Button1">
            <INPUT id="upFile" type="file">

vinod_yadav1919 March 16th, 2005 01:04 AM

Hiii shenliujun

<form id="Form2" method="post" runat="server" enctype="multipart/form-data">
Check whether it is Form1 or Form2
 document.Form1.submit(); //error is here

Cheers :)


joefawcett March 17th, 2005 04:11 AM

A built in security feature prevents file data being uploaded when the browse box is opened programatically on some browsers. Otherwise it would be too easy with a naive user to upload files without the user being aware of it.


Joe (Microsoft MVP - XML)

All times are GMT -4. The time now is 03:45 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.