itinance / itinance/react-native-fs
android uploadFiles failed
- Dominant language
- C++
- Stars
- 5k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
## I used [react-native-document-picker](https://www.npmjs.com/package/react-native-document-picker) to choose a file in android phone dir.
It return data like
```json
{
"uri": "content://com.android.providers.downloads.documents/document/2584",
"fileSize": 49056,
"fileName": "14-40-31-u=879534645,1757311023&fm=173&app=49&f=JPEG.jpg",
"type": "image/*"
}
```
Then I take it as a parameter of **uploadFiles**, and it will throw Error. like:

## I guess **uploadFiles** may require absolute paths
Then I try to copy the selected file to the `DocumentDirectory` directory and `TemporaryDirectory` directory. So I got a relative path.
```txt
content://com.android.providers.media.documents/document/image%3A978972
/data/user/0/com.demomobile/cache/image%3A978972
```
Then i used the relative path `/data/user/0/com.demomobile/cache/image%3A978972` to upload, it return the same Error.
## The file really don't exist?
Then I use `readFile` to check those path. both `content://com.android.providers.media` and `/data/user/0/com.demomobile/cache/` have successfully returned content.
## So I guess there's a problem with **uploadFiles**
Please help me solve this problem.
"react": "16.8.3",
"react-native": "0.59.3",
"react-native-document-picker": "2.3.0",
"react-native-fs": "2.13.3",
android version: 9.0
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.