title: Upload base64 image to the server with Axios and React native
body: <p>Actually we have site which use dropzone.js for uploading image to the server.</p>
  
  <p>I'm working with react native app and need to replicate dropzone js behavior. </p>
  
  <p>I'm trying to send base64 image but request return <code>Multipart requests must contain at least one part.</code></p>
  
  <pre><code> saveImages(images) {
      let config = {
          headers: {
              'Content-Type': 'multipart/form-data',
              'X-Requested-With': 'XMLHttpRequest'
          }
      };
      images.forEach(img =&gt; {
          let imgFormData = `data:${img.mime};base64,${(img.data)}`;
          let blob = this.dataURItoBlob(imgFormData);
          let formData = new FormData(document.forms[0]);
          formData.append('file', blob);
          axios.post(SAVE_IMAGE_URL, formData, config)
              .then(res =&gt; console.log(res))
              .catch(err =&gt; {
                  console.log(err);
                  console.log(err.status);
                  console.log(err.code);
              })
      });
  }
  
      dataURItoBlob = (dataURI) =&gt; {
  
          let byteString;
          if (dataURI.split(',')[0].indexOf('base64') &gt;= 0)
              byteString = atob(dataURI.split(',')[1]);
          else
              byteString = unescape(dataURI.split(',')[1]);
  
          let mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
  
  
          let ia = new Uint8Array(byteString.length);
          for (let i = 0; i &lt; byteString.length; i++) {
              ia[i] = byteString.charCodeAt(i);
          }
  
          return new Blob([ia], {type:mimeString});
  }
  </code></pre>