Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 15th, 2005, 10:11 PM
Registered User
 
Join Date: Jul 2004
Location: hf, ah, China.
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" >
<HTML>
    <HEAD>
        <title>WebForm2</title>
        <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.all.upFile.click();
           document.Form1.submit(); //error is here
        }
        </script>
    </HEAD>
    <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">
        </form>
    </body>
</HTML>

Reply With Quote
  #2 (permalink)  
Old March 16th, 2005, 01:04 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
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
Default

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

vinod
Reply With Quote
  #3 (permalink)  
Old March 17th, 2005, 04:11 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

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)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 02:35 AM.


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