filestack / filestack-js

Official Javascript SDK for the Filestack API and content ingestion system.
https://www.filestack.com
MIT License
206 stars 77 forks source link

Cannot upload in react-native #365

Open thenderson55 opened 4 years ago

thenderson55 commented 4 years ago

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 commented 4 years ago

Found a solution:

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

NTonani commented 3 years ago

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?

thenderson55 commented 3 years ago

No - just basic upload.

TannerLessen commented 2 years ago

@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.