Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services 使用react-native相机拍照后,使用react-native将图像上载到aws S3_Amazon Web Services_React Native_Amazon S3 - Fatal编程技术网

Amazon web services 使用react-native相机拍照后,使用react-native将图像上载到aws S3

Amazon web services 使用react-native相机拍照后,使用react-native将图像上载到aws S3,amazon-web-services,react-native,amazon-s3,Amazon Web Services,React Native,Amazon S3,我是react native的初学者。我想在使用react native相机拍摄完照片后将文件上传到aws s3。我可以使用react本机相机拍照。现在,我需要上传到s3 bucket。当我搜索这个时,我得到了很多文档,我不知道如何使用它 我已经使用php将文件上传到AmazonS3并下载表单s3。但是在react native中,我不知道如何做,因为我是一个初学者。我用php、java和.Net等搜索了aws s3文件上传文档,但没有找到react native 有人能帮我做这件事吗 我在re

我是react native的初学者。我想在使用react native相机拍摄完照片后将文件上传到aws s3。我可以使用react本机相机拍照。现在,我需要上传到s3 bucket。当我搜索这个时,我得到了很多文档,我不知道如何使用它

我已经使用php将文件上传到AmazonS3并下载表单s3。但是在react native中,我不知道如何做,因为我是一个初学者。我用php、java和.Net等搜索了aws s3文件上传文档,但没有找到react native

有人能帮我做这件事吗

我在react native中拍摄图像的代码是

import React, {Component} from 'react';
import {Platform, StyleSheet, Text,TouchableOpacity, View} from 'react-native';
import ImagePicker from 'react-native-image-picker';
import RNS3 from 'react-native-aws3';
export default class App extends Component<Props> {
  takePic(){
    ImagePicker.showImagePicker({},(responce)=>{
      console.log(responce);
      const file ={
        uri : responce.path,
        name : responce.fileName,
        type :  responce.type,
      }
      console.log(file);
      const config ={
        keyPrefix :'uploads/',
        bucket : '**',
        region :'***',
        accessKey:'***',
        secretKey :'***',
        successActionStatus :201
      }
      RNS3.put(file ,config)
      .then((responce) => {
        console.log(responce);
      })
    })
  }
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>Welcome v</Text>
        <TouchableOpacity onPress={this.takePic.bind(this)}>
          <Text>Take Picture</Text>
        </TouchableOpacity>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});
如何解决此ReactNativeJS:undefined不是对象(计算'\u reactNativeAws.default.put')

你能帮我解决这个问题吗。

我已经解决了我的错误:):)。最后,它在4天后终于工作了。太高兴了

我已安装react本机文件上载。现在它工作得很好

npm install react native file upload--保存

我已经解决了我的错误:):)。最后,它在4天后开始工作。太高兴了

我已安装react本机文件上载。现在它工作得很好


npm install react本机文件上载--保存

查看此链接谢谢Ron。我使用了相同的方法,但是我得到的未定义不是一个对象(计算'\u reactNativeAws.default.put')错误。甚至我也试着去寻找答案。但是我没有收到任何错误。你能看看我上传的代码并帮我解决这个问题吗。你好,Ron,我需要在aws s3中进行任何配置吗?你必须公开存储桶,以便在s3中存储数据检查此链接谢谢Ron。我使用了相同的方法,但是我得到的未定义不是一个对象(计算'\u reactNativeAws.default.put')错误。甚至我也试着去寻找答案。但是我没有收到任何错误。你能看看我上传的代码并帮我解决这个问题吗。你好,罗恩,我需要在aws s3中进行任何配置吗?为了在s3中存储数据,你必须公开存储桶
02-05 09:10:52.738 12357 12389 I ReactNativeJS: { uri: '/storage/emulated/0/Pictures/image-cb48f179-5b00-4e0a-93ef-74206f76c4e4.jpg',
02-05 09:10:52.738 12357 12389 I ReactNativeJS:   name: 'image-cb48f179-5b00-4e0a-93ef-74206f76c4e4.jpg',
02-05 09:10:52.738 12357 12389 I ReactNativeJS:   type: 'image/jpeg' }
02-05 09:10:52.738 12357 12389 E ReactNativeJS: undefined is not an object (evaluating '_reactNativeAws.default.put')