我正在尝试从cameraRoll上传图像.事情是cameraRoll组件返回content:// URI而不是实际的文件路径.要上传图像,我需要一个文件路径,有没有办法将content:// URI转换为文件URI?谢谢 我接受了@Ma
你可以在这里找到它:react-native-get-real-path
因此,要实现您想要的,您可以将上述模块与react-native-fs结合使用
当您想从相机胶卷上传所选图像时,您可以执行以下操作:
RNGRP.getRealPathFromURI(this.state.selectedImageUri).then(path => RNFS.readFile(path, 'base64').then(imageBase64 => this.props.actions.sendImageAsBase64(imageBase64) ) )