Event Button FileUpload with submit Gmail style

3

I'm using vb.net and asp.net with forms and need to add an event that when clicking the select a file to attach button, when I select the file it automatically saves, without having to have another button to give the submit Gmail style. Could someone give me a light?

    
asked by anonymous 15.04.2016 / 17:46

2 answers

1

jQuery uploadify plugin will load with a progress bar, and includes functionality for uploading single or multiple files. / p>     

15.04.2016 / 18:34
0

You can use the change event, in javascript. Then you send the form when the file input triggers this event. Example:

file = document.getElementById("file");
form = document.getElementById("form");

file.addEventListener('change', function(){ //quando o input de arquivo mudar...
	form.submit();                          //...o form é enviado
})
<form enctype="multipart/form-data"
      method="post"
      action="seu_script.php"
      id="form">
  <input type="file" name="arquivo" id="file" />      
</form>

Inside the stack overflow will not work because it prevents the submit from form, but you can see it working at: link

    
15.04.2016 / 18:43