Uploading blob file to Amazon s3

后端 未结 2 1854
被撕碎了的回忆
被撕碎了的回忆 2021-01-05 10:58

I am using ngCropImage to crop an image and want to upload it following this link:

NgCropImage directive is returning me dataURI of the image and I am converting it

2条回答
  •  粉色の甜心
    2021-01-05 11:19

    You can always create file from blob. You can pass file name also.

    var file = new File([blob], "filename");
    

    This same file object you can use to upload on s3.

    Change your handleSave method to following. File name will be abc.png for now

    //for uploading
    $scope.handleSave = function(){
      blob = dataURItoBlob($scope.myCroppedImage)
      $scope.upload(new File([blob], "abc.png"));
    }
    

提交回复
热议问题