Submitting form from input[type=file] dialog box

I am attempting to trigger a form submit from an input [type=file] dialog box window. I realize this might be a bit substandard, but here's what I'm trying to do.

  1. User clicks the browse button, and input[type=file] dialog window is invoked letting the user select a file.

  2. After the user selects file and when the open button is pressed in the same window, the file dialog box (in addition to whatever else it does), submits the specified form (jQuery perhaps?) with the selected image.

This actually works quite well for the media library window using the following code:

wp.media.wpUserAvatar.frame().state('library').on('select', function() {
        jQuery([class='name-of-form'] input[type='submit']).click();
    });

So I'm hoping there's an equivalent for the standard file input window.

thanks!

Topic wp-filesystem jquery Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.