benjreinhart / react-native-aws3

Pure JavaScript React Native library for uploading to AWS S3
MIT License
398 stars 151 forks source link

Could not retrieve file for uri data:image/png;base64…suc//AHg//at4MGDGLOrp7ff2T0a8Vk+3jO3P+zr9t5v/AP/Z" #84

Open codal-mpawar opened 5 years ago

codal-mpawar commented 5 years ago

const img_uri = data:image/png;base64, ${value}; const file = { uri: img_uri, name: "image.png", type: "image/png" }; const options = { keyPrefix: "media/public/profile/", bucket: "asdasdasdsad", region: "asdsadsad", accessKey: "asdasdsadsadsadsadadadad", secretKey: "dasdsadsadsadadasdasdasdsadasd", successActionStatus: 201 }; RNS3.put(file, options)

umair-dpl commented 4 years ago

use a suitable converter for base64 instead then pass the uri

prakhar-mindcrew commented 3 years ago

did you find solution for this ?

umair-dpl commented 3 years ago

@prakhar-mindcrew use this library : import { RNS3 } from "react-native-upload-aws-s3-master"; options = { keyPrefix: "media/story/" + (imagesToUpload[file].type == "video/mp4" ? "video/" : "image/"), bucket: "your bucket", region: "your region", accessKey: "your access key", secretKey: "your secret key", successActionStatus: 201, maxRetries:4 }; let response = await RNS3.put(imagesToUpload[file], options);