update generic file upload in AngularJS directive and REST service