Vydia / react-native-background-upload

Upload files in your React Native app even while it's backgrounded. Supports Android and iOS, including camera roll assets.
MIT License
726 stars 332 forks source link

how do i use this component with my php files on the server? #192

Open luigbren opened 4 years ago

luigbren commented 4 years ago

is there any possibility to use this component with my php configuration? as I normally use in my application..

........
        let filextns = this.getextensionfile(uriImg)
        let formData = {
          filewidth: i.width,
          fileheight: i.height,
        }
        let formDataPost = new FormData();
        for (let p in formData) formDataPost.append(p, formData[p]);
        formDataPost.append('file', {
          type: typeimg,
          uri: uriImg,
          name: 'imag-temp.' + filextns
        })

        const urldata = this.hostconex + 'upfiles.php';
        fetch(urldata, {
          method: 'POST',
          headers: {
            'Accept': 'application/json',
            'Content-Type': 'multipart/form-data',
          },
          body: formDataPost
        })

and on my server php I receive the files using $_FILES['file'], How would I go about using this component, any examples?