Reactjs Can';t find变量:带有axios图像上载的文件

Reactjs Can';t find变量:带有axios图像上载的文件,reactjs,react-native,axios,image-uploading,Reactjs,React Native,Axios,Image Uploading,我了解到axios非常适合将图像上传到数据库,以下是我目前获得的信息: var photo = { uri: this.state.userimgSource, type: this.state.userimgSourceType, name: file, <-- here fileName: Image.png }; var body = new FormData(); body.append('file', photo); axios({ method: 'po

我了解到axios非常适合将图像上传到数据库,以下是我目前获得的信息:

var photo = {
  uri: this.state.userimgSource,
  type: this.state.userimgSourceType,
  name: file, <-- here
  fileName: Image.png
};
var body = new FormData();
body.append('file', photo);
axios({
    method: 'post',
    url: `https://www.example.com/React/user-image-upload.php`,
    data: body,
    config: { headers: {'Content-Type': 'multipart/form-data' }}
})
var photo={
uri:this.state.userimgSource,
类型:this.state.userimgSourceType,

name:file,您需要添加头,例如头:{'accept':'application/json','accept Language':'en-US,en;q=0.8','Content-Type':
multipart/form-data;boundary=${form.\u-boundary}
,}。如果这不起作用,那么您可以查看此处我不明白您为什么需要将文件命名为?
name:file
应该是
$\u文件['uploaded\u file'的位置吗
在my
upload.php中
@SelmiKarim@SaurabhGhewari还有,我做了你做的所有事情,所以我仍然得到那个错误。名称和文件名之间的区别是什么?这和它有什么关系吗。