filestack-js icon indicating copy to clipboard operation
filestack-js copied to clipboard

Cannot upload in react-native

Open thenderson55 opened this issue 5 years ago • 4 comments

I use filestack-js in my regular React application and it works fine.

Now we are building mobile with react-native.

Reading from filestack seems fine but I cannot get upload working.

The data I get when selecting a photo using a file picker is this:

Screenshot 2020-07-06 at 12 47 12

I tried using just data(base64) and got this error:

Screenshot 2020-07-06 at 12 45 14

So I added "data:image/jpeg;base64," to the beginning since this is what the normal react one does and got this error:

Screenshot 2020-07-06 at 12 43 00

If I try with uri or origURL I get this error:

Screenshot 2020-07-06 at 12 46 46

This is my code, which is the same as the working version in regular React application:

 const upload = async () => {
    try {
       const photoRes = await filestack.upload(<above input>);
       console.log("Result: ",  photoRes);
     } catch (err) {
       console.error("Filestack error: ", err);
     }
   };

Any help please- I would really like to be able to filestack across all platforms.

thenderson55 avatar Jul 06 '20 04:07 thenderson55

Found a solution:

https://github.com/8base/Documentation/blob/master/docs/development-tools/sdk/filestack-uploader.md

thenderson55 avatar Jul 06 '20 23:07 thenderson55

Pinging this! Am curious what RN teams are doing.

Uploading through client provides convenient callbacks, how are we to integrate using File API directly? @thenderson55 did your use case require upload progress updates? If so, how'd you handle?

NTonani avatar Apr 19 '21 19:04 NTonani

No - just basic upload.

thenderson55 avatar Apr 20 '21 02:04 thenderson55

@NTonani @thenderson55 Have you (or anyone else) determined a viable way to leverage the filestack-js client in a React Native project? The workaround, while useful in basic cases, is rather limiting.

Curious if anyone has had success integrating the JS client into their project. I, too, get the Unsupported input file type when using a file uri directly no matter what I try.

TannerLessen avatar Jul 14 '22 16:07 TannerLessen