React本机图像上载不适用于PHP远程服务器URL

React本机图像上载不适用于PHP远程服务器URL,php,reactjs,react-native,file-upload,react-native-ios,Php,Reactjs,React Native,File Upload,React Native Ios,当我在php应用程序中使用LocalHostURL时,我能够使用下面给出的react本机代码上传图像。但是,当我将php应用程序托管到服务器时,除了fileupload之外,所有其他API都是从react本机应用程序运行的。 当我调试react本机应用程序从服务器收到的响应时,它显示如下 {"name":"avatar.png","type":"","tmp_name":"","error":1,"size":0} 下面给出了用于文件上载的react本机代码 upload(){

当我在php应用程序中使用LocalHostURL时,我能够使用下面给出的react本机代码上传图像。但是,当我将php应用程序托管到服务器时,除了fileupload之外,所有其他API都是从react本机应用程序运行的。 当我调试react本机应用程序从服务器收到的响应时,它显示如下

{"name":"avatar.png","type":"","tmp_name":"","error":1,"size":0}
下面给出了用于文件上载的react本机代码

upload(){
        const body = new FormData(); 
        body.append('uid', 1);
        body.append('image', {
                uri: this.state.avatarSource.uri,
                type: this.state.avatarSource.type, 
                name: this.state.avatarSource.fileName, 
                size:this.state.avatarSource.fileSize 
            })            
        fetch(config.API_URL+"/upload/image/1", {
            method: 'POST',
            body: body
        })
            .then(res => res.text())
            .then((responseJson) => {
               console.log(responseJson);
            })
            .catch((error) => {
              console.log(error);
            });
}

addPhotos(){
ImagePicker.showImagePicker(options, (response) => {
  console.log('Response = ', response);
  if (response.didCancel) {
    console.log('User cancelled image picker');
  } else if (response.error) {
    console.log('ImagePicker Error: ', response.error);
  } else {

    const source = response;

   console.log(source);
    this.setState({
      avatarSource: source
    });
  }
});
}

我还尝试了下面的选项来获取uri,这在localhost中可以像上面的代码那样工作

source = { uri: response.uri.replace('file://', '')}
我错过了什么?我是否必须在ios清单或其他任何地方添加任何配置或设置,才能使用远程服务器

注意:我已经测试了远程服务器代码直接与邮递员和图像上传工作。它不仅在托管后在react本机应用程序中工作