.config({
fileCache : true,
// android only options, these options be a no-op on IOS
})
.fetch('GET', 'http://117.12.209.52/jdrr_cert_gen/images/image_283.jpg', {
//some headers ..
})
.then((res) => {
// the path should be dirs.DocumentDir + 'path-to-file.anything'
console.log('The file saved to ', res.path())
})
console.log('The file saved to ', res.path()) returns /data/user/0/com.myapp/files/RNFetchBlobTmp_x34fi32dgqgwbthcfrdc8e
I have also used download manager and specific path but unable to loacte file.
When i am using download manager, I also get a notification but no image.
React native : 0.56
Mutliple Physical devices used
Respone when we use download manager
respInfo:
headers:
accept-ranges: "bytes"
cache-control: "public, max-age=31536000"
cf-cache-status: "HIT"
cf-ray: "46b1c2a30f1b8aaf-BOM"
content-length: "606640"
content-type: "image/jpeg"
date: "Wed, 17 Oct 2018 09:32:51 GMT"
expect-ct: "max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct""
expires: "Thu, 17 Oct 2019 09:32:51 GMT"
last-modified: "Fri, 05 Oct 2018 2:21:52 GMT"
server: "cloudflare"
set-cookie: "__cfduid=db7793343e709a7e22de59e602d00a6b21539768771; expires=Thu, 17-Oct-19 09:32:51 GMT; path=/; domain=.pexels.com; HttpOnly"
vary: "Accept-Encoding"
x-cache: "HIT, MISS"
x-content-type-options: "nosniff"
x-served-by: "cache-lax8625-LAX, cache-bom18225-BOM"
__proto__: Object
redirects: Array(1)
0: "https://images.pexels.com/photos/570987/pexels-photo-570987.jpeg"
length: 1
__proto__: Array(0)
respType: ""
rnfbEncode: "path"
state: "2"
status: 200
taskId: "tyaaued2h7826b0kfna1m"
timeout: false
I got the same problem did you solve this ?
in my case i change my dir
from
.config({
// response data will be saved to this path if it has access right.
path : '/data/0/user/{packageName}/file/{imageName}.jpg'
})
to
.config({
// response data will be saved to this path if it has access right.
path : '/storage/emulated/0/{appName}/{imageName}.jpg'
})
and, it works.
if you have a better solution please tell me
no did not solve this... will try ur solution
Make sure to check you have the write external storage permission for android, I left this out and everything appeared to work correctly accept file wouldn't show up
Got the same problem, how did you do to locate the file?
(I've actived the WRITE_EXTERNAL_STORAGE permission)
I'm facing the same issue but only in iOS device using RNFetchBlob.fs.dirs.DocumentDir as path. The fetch response comes with the correct path but after download i got no file.
EDIT:
i've solved this by using WRITE_EXTERNAL_STORAGE permission on Android.
And using this keys in info.plist for iOS:
<key> UIFileSharingEnabled</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
As described here, to enable file sharing in the app Document folder.
I was faced same issue, but it solved. Simple solution that worked was
I'm facing the same issue but only in iOS device using
RNFetchBlob.fs.dirs.DocumentDiras path. The fetch response comes with the correct path but after download i got no file.EDIT:
i've solved this by usingWRITE_EXTERNAL_STORAGEpermission on Android.
And using this keys in info.plist for iOS:<key> UIFileSharingEnabled</key> <true/> <key>LSSupportsOpeningDocumentsInPlace</key> <true/>As described here, to enable file sharing in the app Document folder.
After downloading a pdf file using RNFetchBlob, I can see the document exists in RNFetchBlob.fs.dirs.DocumentDir. But, I can not see the file in files app in iOS. It's working fine for Android though.
That happened to me... I solved by adding the fix mentioned above, but I also created a new folder inside RNFetchBlob.fs.dirs.DocumentDir to store my PDF files. Don't know if this will help you but you can try.
@vitorverasm o comando WRITE_EXTERNAL_STORAGE eu colocaria aonde no projeto android? E tem diferen莽a entre colocar ele e ativar manualmente o armazenamento?
@RaphaPetrere vc tem q incluir essa permiss茫o no arquivo android/app/src/main/AndroidManifest.xml :
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
脡 importante colocar a defini莽茫o do uso da permiss茫o no manifest, ao fazer isso o app ja identifica que precisa dessa permiss茫o e vc n茫o tem que ativar manualmente.
Most helpful comment
I'm facing the same issue but only in iOS device using
RNFetchBlob.fs.dirs.DocumentDiras path. The fetch response comes with the correct path but after download i got no file.EDIT:
i've solved this by using
WRITE_EXTERNAL_STORAGEpermission on Android.And using this keys in info.plist for iOS:
As described here, to enable file sharing in the app Document folder.