JavaScript submit form as soon as file was selected

I have following html form:

<form method="POST"  action="uploadImage" enctype="multipart/form-data">
                        <input type="file" class="file" name="file"/>
                        <input type="submit" value="Upload">
    </form>

I see two things on page
1 - file selector
2 - upload button

I want to avoid submit button and form should be submitted right after file was selected.

Can you help me?

Answer:1

Maybe this helps you:

$('.file').change(function(){
    $('form').submit();
});
Answer:2

I am developing an app using jQuery Mobile with PHP. I am not using Phonegap or other frameworks. I need to find user's geolocation. If user device's GPS is off, then I cant get a location. now I need ...

I am developing an app using jQuery Mobile with PHP. I am not using Phonegap or other frameworks. I need to find user's geolocation. If user device's GPS is off, then I cant get a location. now I need ...

  1. check device user agent
  2. php check user device
  3. check point user device management
  4. check user agent mobile device

I have a very simple module that I am bundling with Browserify. I want to use that bundle both in the browser as well as in node. In node, it works just fine if I require the non-bundled module; ...

I have a very simple module that I am bundling with Browserify. I want to use that bundle both in the browser as well as in node. In node, it works just fine if I require the non-bundled module; ...

  1. require returns empty object
  2. node require returns empty object
  3. nodejs require returns empty object
  4. webpack require returns empty object
  5. require('fs') returns empty object
  6. javascript require returns empty object
  7. browserify require returns empty object
  8. require module returns empty object

I have the following iframe: <iframe name="content" src="" style="position: absolute; left: 0px; top: 28px;" allowtransparency="true" border="0" scrolling="yes" width="100%" frameborder="0" height=...

I have the following iframe: <iframe name="content" src="" style="position: absolute; left: 0px; top: 28px;" allowtransparency="true" border="0" scrolling="yes" width="100%" frameborder="0" height=...

  1. capture screenshot iframe
  2. javascript capture screenshot iframe

I have compiled my app using Phonegap build and successfully running the app on android 4.4.3, but when installed on an old 2.3.5 phone although the app runs it does not work on the href elements. I ...

I have compiled my app using Phonegap build and successfully running the app on android 4.4.3, but when installed on an old 2.3.5 phone although the app runs it does not work on the href elements. I ...