remobile / react-native-file-transfer

A file-transfer for react-native, code come from cordova, support for android and ios
MIT License
85 stars 22 forks source link

How to upload from assets-library #1

Open kinhunt opened 8 years ago

kinhunt commented 8 years ago

It gives me file not found error

DylanVann commented 7 years ago

Any news on this?

fov42550564 commented 7 years ago

wirte a plugin copy assets from sdcard, then upload

DylanVann commented 7 years ago

This is an iOS issue. With photos and videos you'll get an asset path instead of a real path. When this module tries to get NSData from that it fails.

I fixed it, will submit a PR.

fov42550564 commented 7 years ago

on ios, you can use Documents dir

DylanVann commented 7 years ago

We get a uri like this on iOS assets-library://asset/asset.JPG?id=575ABD7C-3DDD-47E6-AD12-F4918D7B211F&ext=JPG. Trying to transfer that file causes an error. What we want is to get NSData from that uri and send it, we don't want to have to copy the file to the documents directory first. I've implemented this, but it isn't as clean as it could be. I'll send a PR on the weekend.

DylanVann commented 7 years ago

https://github.com/remobile/react-native-file-transfer/pull/7