Wrox Programmer Forums
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 15th, 2005, 10:11 PM
Registered User
Join Date: Jul 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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">

Old March 16th, 2005, 01:04 AM
Friend of Wrox
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919

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 :)

Old March 17th, 2005, 04:11 AM
joefawcett's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

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)

Similar Threads
Thread Thread Starter Forum Replies Last Post
get outside form access angelboy C# 2005 1 September 10th, 2007 03:57 AM
Access Report from Access PivotTable Form Odeh Naber Access 2 July 24th, 2007 09:33 AM
Access form to web form clott BOOK: Access 2003 VBA Programmer's Reference 0 February 13th, 2006 06:44 PM
Resize Access main window from Access form hasseh Access VBA 2 October 24th, 2004 05:15 PM
Access Form jemacc Access 3 December 22nd, 2003 03:34 PM

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