Solved

HTML Form onChange Submit

Posted on 2004-10-13
5
1,012 Views
Last Modified: 2012-08-13
Here is the code:

  <html>
  <head></head>
  <body>
    <form name="test_form" method="POST" enctype="multipart/form-data" action="uploadTester.asp">
      <input type="file" name="attach1" onChange="this.form.submit();" style="display: none;">
      <input type="button" onClick="attach1.click();" value="Select a File">
    </form>
  </body>
  </html>

The problem is the form is not submitting.  I'm getting an "Access is Denied." error.  If I change the style on the file input control so it will display, and click on that control directly, the form is submitted.  The problem with this is I don't want the users to see the text box associated with the file control so I developed this workaround.  I need to know why it won't submit this way though.

Thanks
0
Comment
Question by:macaulish
5 Comments
 
LVL 49

Accepted Solution

by:
Roonaan earned 125 total points
ID: 12300713
The same as why you cannot give the file-type input a default value. It would be to hazardous. Besides: people don't like to have file selection things look different from what they used to. You should be aware that people are acustomed to how the file input works at all the sites they goto and use it. It is confusing to have it look differently or to have it act differently. What will you do if someone accidently selects msdos.sys or some other file and things submit automatically. This would give your visitor a great sense of insecurity. Therefor I my opinion, it is a good thing that this isn't working.

Regards

-r-
0
 
LVL 1

Author Comment

by:macaulish
ID: 12301417
Ronaan,

Thanks for your reply.  This is an intranet site with a limited amount of users in an asp database application.  The users do not need to see this control, they only need to pick a file to upload.

MacAulish
0
 
LVL 53

Assisted Solution

by:COBOLdinosaur
COBOLdinosaur earned 125 total points
ID: 12303073
You have two options.  Use a conventional form, or write an activex control that ignores the security restrictions, and wait for one of your users to exploit the hole to trash your database.

Cd&
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question