title: How to use fetch to upload binary file in react native with react-native-image-crop-picker
body: <p>I have some trouble in uploading file to server,because I can't find a method to convert img to  binary data struct.</p>
  <p>a success request like this in swagger
  <a href="https://i.stack.imgur.com/qPg72.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qPg72.png" alt="enter image description here" /></a></p>
  <br/>
  <p><a href="https://i.stack.imgur.com/09ARO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/09ARO.png" alt="enter image description here" /></a></p>
  <pre><code>// upload function 
  const UploadImg = async (img: any) =&gt; {
    // img  from  react-native-image-crop-picker
    const fromData = new FormData();
    fromData.append('file', `${img.data}`);
  
    return fetch(`${API_URL_R}/upload`, {
      method: 'POST',
      body: fromData, // this should be binary 
    })
  };
  
  // use
  // import ImagePicker from  'react-native-image-crop-picker'
   ImagePicker.openPicker({
        width: 300,
        height: 400,
        cropping: true,
        includeBase64: true,
      }).then(async image =&gt; {
        await UploadImg(image);
      });
  
  
  
  </code></pre>