I am trying to use upload control in angular Js. The functionality works fine in chrome, but does not work in IE 11. Below is the code used:
<div>
<input type="file" class="form-control" id="imageUploadfile" name="Imagefile" ng-files="getTheFiles($files)" accept="image/*" />
<input type="button" name="imageUploadButton" ng-click="uploadFiles()" value="Upload" />
</div>
In the controller.js file,
var formdata;
$scope.getTheFiles = function ($files) {
formdata = new FormData();
angular.forEach($files, function (value, key) {
formdata.append(key, value);
});
};
$scope.uploadFiles = function () {
TestAPIService.postUploadImage(formdata).success(function (response) {
var imageurl = _TestBaseUrl + 'Images/' + response.filePath.split(/(\\|\/)/g).pop();
$scope.testTypeImage_url = imageurl;
}).error(function (response) {
alert(response.responseText);
});
};
The above code is working fine in chrome, where I am able to upload the file. The error is in formdata , as the "key, value" are not getting added.
How to fix this? Thanks