title: Save image picked from ReactNative/Expo ImagePicker to Baqend
body: <p>I'm having a hard time saving an image that is being picked from Expo (React Native).</p>
  
  <p><a href="https://docs.expo.io/versions/latest/sdk/imagepicker.html" rel="nofollow noreferrer">https://docs.expo.io/versions/latest/sdk/imagepicker.html</a></p>
  
  <p>It seems that React Native does not have support for uploading the selected image as blob, but does have a base64 option.</p>
  
  <p>The code:</p>
  
  <pre><code>_pickImage = async () =&gt; {
      let pickerResult = await ImagePicker.launchImageLibraryAsync({
          allowsEditing: true,
          base64: true,
          aspect: [4, 4],
      });
      this._handleImagePicked(pickerResult);
  };
  
  
  _handleImagePicked(pickerResult) {
      const uri = pickerResult.base64;
      const img = new db.File({ name: 'test.jpg', data: uri, type: 'base64', mimeType: 'image/jpg' });
  
      db.UserData.load(this.state.UserDataID).then(UserData =&gt; {
          img.upload({ force: true }).then((file) =&gt; {
              UserData.photo = "https://remarkable-apple-95.app.baqend.com/v1" + file.id;
              alert(file.id)
              return UserData.update();
          },
              (error) =&gt; { alert(error); }
          );
      });
  }
  </code></pre>
  
  <p>When I <code>console.log(pickerResult.base64)</code> I get a super long string that looks like base64, but when this is run, the <code>img.upload</code> is throwing the error and it says <code>"PersistentError: An unexpected persistent error occurred."</code></p>