Uploading blob file to Amazon s3

后端 未结 2 1841
被撕碎了的回忆
被撕碎了的回忆 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"));
    }
    
    0 讨论(0)
  • 2021-01-05 11:37

    It is not advisable that you do to put the key

    secretAccessKey: $.trim($scope.creds.secret_key)

    on the client side ... That is not done !, anyone can manipulate your bucket at will.

    0 讨论(0)
提交回复
热议问题