angular-file-upload
angular-file-upload copied to clipboard
Upload content of a file instead of the file itself
I would like to upload contents of a .json file instead of file. I tried multiple ways to figure it out but couldn't find any solution despite. Thus would be glad if this is said. Thanks
For those of you who are struggling to upload a JSON data instead of file. Kindly do the following.
var uploader = $scope.uploader = new FileUploader({});
uploader.uploadItem = function (item) {
var reader = new FileReader();
reader.readAsBinaryString(item._file);
reader.onloadend = function(){
item.data = reader.result;
}
// Here you can add item.data into your request body. };
Kindly close this issue as it's solved
Kindly close this issue as it's solved
Done =)