Solved

HTML Form onChange Submit

Posted on 2004-10-13
5
985 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now