0

I am using php file attachment to upload file. In DB i am getting the file name with the extension of the file and storing it into DB. There is the modify button which will fetch all the entries from the DB and display on the screen. There is one text field, and one file type field.

Now the problem is I am not able to set the file to the file type field, so please help me in this.

Thanks in Advance.

1 Answers1

0

since you havent provided any code sample, it hard to pinpoint what issue your having , but my guess is your looking for something like this

<input type="file" id="file" name="file"/>
<button ng-click="add()">Add</button>

and the to get file content use the below code

$scope.add = function(){
   var f = document.getElementById('file').files[0],
   r = new FileReader();
   r.onloadend = function(e){
   var data = e.target.result;
  //send your binary data via $http or $resource or do anything else with it
}
r.readAsBinaryString(f);
}

for more info check this link enter link description here

Community
  • 1
  • 1
user46772
  • 241
  • 1
  • 2
  • 13