Here is my HTML form:
<form name="myForm" ng-submit="">
<input ng-model='file' type="file"/>
<input type="submit" value='Submit'/>
Some of the answers here propose using
FormData(), but unfortunately that is a browser object not available in Internet Explorer 9 and below. If you need to support those older browsers, you will need a backup strategy such as using
<iframe> or Flash.
There are already many Angular.js modules to perform file uploading. These two have explicit support for older browsers:
And some other options:
One of these should fit your project, or may give you some insight into how to code it yourself.