#[SOLVED] getFilePreview() doesn't work with react-native

22 messages · Page 1 of 1 (latest)

humble tartan
#

const fileurl - await storage.getFilePreview(appwriteConfig.storageId, fileId, 2000, 2000, 'top', 100);
console.log('Uploaded file URL: ' + fileUrl);
// LOG -> Uploaded file URL: [object ArrayBuffer]

sharp matrix
#

@untold nacelle can you explain how are we suppose to use this?
The release suggest that it does not returns url but download. What if we just want to view it not download it. What is the new method to do this the old way?

humble tartan
#

Well, i tried :
const fileUrl = await storage.getFilePreviewURL(appwriteConfig.storageId, fileId, 2000, 2000, 'top', 100);
console.log('Uploaded file URL: ' + fileUrl);
// OUTPUT -> https://nyc.cloud.appwrite.io/v1/storage/buckets/<<storage_ID>>/files/<<file_id>>/preview

But the url doesnt seem to work, when i open the url on a browser (Opera GX) i get this :
{"message":"Storage bucket with the requested ID could not be found.","code":404,"type":"storage_bucket_not_found","version":"1.7.4"}

sharp matrix
humble tartan
#

the storage bucket is the storage id i get in the appwrite website?

sharp matrix
#

Yes

humble tartan
#

Yes it is the same

sharp matrix
humble tartan
#

Okay, Thanks a lot

untold nacelle
untold nacelle
untold nacelle
abstract hemlock
#

Are you Free tier? If so, I also encountered this issue and this feature or some sort is similar to editing which is on Pro Tiers

#

So just used getfileViewUrl instead

fluid rover
sharp matrix
fluid rover
humble tartan
#

Yess, it works. Thank you.