1

I am cropping the image . But When I upload it to the amazon , it saves the originalfile.

 function _handleFileSelect(evt) {
                $scope.beforeLogoSelect = false;
                $scope.file = evt.currentTarget.files[0];
                var reader = new FileReader();
                reader.onload = function(evt) {
                    $scope.$apply(function($scope) {
                        $scope.myImage = evt.target.result;
                    });
                };
                reader.readAsDataURL($scope.file);
            }

This way I get the url of the image and assign it to the cropped image tag.

Now How shal i save the cropped file to a file variable so that I can upload to amazon s3? I want the resultant cropped image in $scope.file.

Thanks.

sabari
  • 2,595
  • 5
  • 28
  • 44

1 Answers1

2

Converting the data uri to blob was the solution.

Convert Data URI to File then append to FormData

Might be useful for others.

Community
  • 1
  • 1
sabari
  • 2,595
  • 5
  • 28
  • 44