Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6350249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:46:30+00:00 2026-05-24T21:46:30+00:00

Normally, to upload a file, it would be two-steps process – select a file

  • 0

Normally, to upload a file, it would be two-steps process – select a file and then confirm upload. I am working on uploading profile picture. Since profile pic is usually small, I want to reduce mouse-clicks for my users by making the file upload to start upon file selection. Please suggest good, and perhaps common, ways to achieve this (I would also like to learn their pitfalls, if any). Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:46:31+00:00Added an answer on May 24, 2026 at 9:46 pm

    The change event will fire when a file is selected from a file upload field. The value of the field will be '' if no file is selected (field is cleared).

    <form method="post" action="upload.script">
        <input type="file" id="formfile"/>
        <input type="submit" id="formsubmit"/>
    </form>
    
    <script type="text/javascript">
        var file= document.getElementById('formfile');
        var submit= document.getElementById('formsubmit');
    
        // If scripting is available, can auto-submit the form, so no submit
        // button needed.
        //
        submit.parentNode.removeChild(submit);
    
        // When field is filled in with a filename, submit form
        //
        file.onchange= function() {
            if (this.value!=='')
                this.form.submit();
        };
    </script>
    

    Is this a good idea? Questionable. Automatically submitting a form if the user doesn’t expect it may have a negative impact.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Normally you can do this: <select size=3> <option>blah</option> <option>blah</option> <option>blah</option> </select> And it would
I'm working on implementing Ajax-Upload for uploading photos in my Rails 3 app. The
Normally I use imagecreatefromjpeg() and then getimagesize() , but with Firefox 3 I need
Normally when using VMWare Server 1.0.7 you are asked if you would like to
Normally, in Delphi one would declare a function with a variable number of arguments
Normally to attach a debuger to a running jvm you would need start the
The file upload script I wrote early last year for an internal website has
Normally I open a window with javascript to show information about a upload progress,
I have an application that upload file to server using NSUrlConnection. It was placed
How would you prevent a browser from timing out while a long process is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.