File not exists
See original GitHub issueFollowing this, i’m trying to get the content file;
Using react-native-document-picker
, after select the file I do this:
if (Platform.OS === 'ios') {
let arr = data.uri.split('/')
const dirs = RNFetchBlob.fs.dirs
filename = RNFetchBlob.wrap(`${dirs.DocumentDir}/${arr[arr.length - 1]}`)
} else {
filename = data.uri
}
const file = await RNFetchBlob.fs.readFile(filename, 'base64')
I also tried:
// filename = RNFetchBlob.wrap(data.uri)
// filename = data.uri
But I always get the same error file not exists
This is the data from react-native-document-picker
:
{
"size": 16669,
"name": "Imagem JPEG.jpeg",
"uri": "file:///private/var/mobile/Containers/Data/Application/63F987D9-81F6-41B1-80A1-8E9E102C82FD/tmp/br.com.app-Inbox/Imagem%20JPEG.jpeg",
"type": "image/jpeg"
}
What could I be missing?
"react": "16.0.0-alpha.12"
"react-native": "^0.48.4"
"rn-fetch-blob": "^0.10.11"
"react-native-document-picker": "git://github.com/Elyx0/react-native-document-picker.git#v3",
Issue Analytics
- State:
- Created 5 years ago
- Comments:11
Top Results From Across the Web
How to check if file does not exist in Bash - nixCraft
-f filename ( test -f filename ) returns true if file exists and is a regular file. The ! (exclamation point) act as...
Read more >How do I tell if a file does not exist in Bash? - Stack Overflow
Negate the exit status with bash (no other answer has said this): if ! [ -e "$file" ]; then echo "file does not...
Read more >How To Check If File or Directory Exists in Bash - devconnected
In order to check if a file does not exist using Bash, you have to use the “!” symbol followed by the “-f”...
Read more >Bash Check If File Not Exists - Linux Hint
To check for the file exists or not, we will be using the “If-then” statement taking its conditions in the single square brackets...
Read more >Bash: How to Check if the File Does Not Exist - DiskInternals
Bash: how to check if the file does not exist? Here you will find the way of how to check if the file...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Wait!!!
Just using
filename = data.uri.replace('file:', '')
as @andonivianez said here, did work!The final code:
I’m going grab a beer, closing for now!
I have tried it with the below way and After that, It’s working fine.