Angularjs FileConstructor is not a constructor '

Problem: Error: FileConstructor is not a designer (assessing "new file ([blob]," filename.png ") ')

I saw this question Alternative to File () constructor for a safari , but there were no alternatives, are worth paying attention to.

Is there a way around this by using Ionic Framework on IOS?

Javascript

a = Image Base64.

var blob = new Blob([a], {type: 'image/png'}); console.log(blob); $scope.Issue14 = blob; var nfile = new File([blob], "filename.png"); console.log(nfile); $scope.Issue15 = nfile; var _file = nfile; console.log(_file); $scope.Issue16 = _file; $scope.Images.push({"img": _file}); 
+5
source share
1 answer

I ran into the same problem with the file and Safari. After some research, I found a solution that seems to work for me ... I hope that it will be useful for you:

Instead of using the new file name, and I will add lastModifiedDate field in the blob.

  blob.name = "filename.png"; blob.lastModifiedDate = new Date(); 

This is not a file, but you can use it as if it was ...

+4
source

All Articles