1

What is the best practices in angularjs when submitting file without a submit button. Here is my sample code.

<form method="post" enctype="multipart/form-data" action="">
   <input type="file" name="file">
</form>

I already tried using onchange, very useful also but what i want is after selecting a file it will make an ajax call (without submit button).

Amboom
  • 156
  • 1
  • 13
  • I think this could be interesting for you: http://stackoverflow.com/a/26711257/1281305 – Jan Bouchner Feb 11 '16 at 07:12
  • 1
    Don't try to reinvent the wheel. There are some cool libraries for this purpose like [ng-file-upload](https://github.com/danialfarid/ng-file-upload) as the first example. – fracz Feb 11 '16 at 07:18
  • Just make a post request with form data, 5 lines of code. No need for fancy library if you just want to upload the file. – dfsq Feb 11 '16 at 07:32
  • ng-file-upload is so powerfull.. Thank you so much for your help... cheers. – Amboom Feb 11 '16 at 08:17

1 Answers1

1

i have used ngpload module for it.

ngpload

please refer the document from the link this will definitely help you a lot

Pratik Bhajankar
  • 1,144
  • 2
  • 14
  • 27