Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.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
React native 我想用我的uri作为react native中的文件来上传它_React Native_File Upload_Fetch_React Native Android_React Native Ios - Fatal编程技术网

React native 我想用我的uri作为react native中的文件来上传它

React native 我想用我的uri作为react native中的文件来上传它,react-native,file-upload,fetch,react-native-android,react-native-ios,React Native,File Upload,Fetch,React Native Android,React Native Ios,我想在我的服务器上使用post方法上传一个图像,但我有一个小问题 var formdata = new FormData(); formdata.append("file", fileInput.files[0], "IMG_59B84891ADA2-1.jpeg"); var requestOptions = { method: 'POST', body: formdata, redirect: 'follow' }; fetch(&q

我想在我的服务器上使用post方法上传一个图像,但我有一个小问题

var formdata = new FormData();

formdata.append("file", fileInput.files[0], "IMG_59B84891ADA2-1.jpeg");

var requestOptions = {
  method: 'POST',
  body: formdata,
  redirect: 'follow'
};

fetch("http://sample.com/.......", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
我从postman那里复制了这段代码,因为我可以使用postman将照片上传到我的服务器,我想用我的react本机应用程序实现这一点,但我的问题是我只有我的图像uri,我不知道如何使用我的图像uri作为文件来使用这段代码,如果我可以使用uri作为文件或类似的东西,这就是我的问题,我的问题将是解决了


感谢您帮助我改进格式和语法