benjreinhart / react-native-aws3

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

Not able to create Dynamic sub keyPrefix #50

Open iiitmahesh opened 7 years ago

iiitmahesh commented 7 years ago

Not able to create Dynamic sub keyPrefix while uploading Images???

NeerajaaG commented 4 years ago

Hi My requirement is to make my unique deviceId as Prefix and upload pictures in a folder which is prefix

For example my deviceId is '3ac.....'. so I need to create a folder name as '3ac....' and add pictures in them.

I acheived it by storing deviceId in some variable . this.state.deviceId= '3ac....' and pass this variable in RN3 ie... const options = { keyPrefix: this.state.deviceId+ ('/'), bucket : "your bucket name", region :"your region", accessKey:"your Access Key", secretKey :"your secret Key", successActionStatus :201, contentType:"image/png", }
This will find out one solution for changing the folder name or prefix (here unique deviceID) dynamically..

Hope this will helps you