I use C# Appwrite 0.7 package, and I’m on Appwrite 1.14, I try to get a file from a bucket using
var storage = new Storage(client); File result = await storage.GetFile( bucketId: "[BUCKET_ID]", fileId: "[FILE_ID]");
it return the file in result, but I haven’t found the method to show it in picture box, I found some old doc using file.Content, but it doesn’t work anymore. After this I tried to get a preview using
var storage = new Storage(client); byte[] result = await storage.GetFilePreview( bucketId: "[BUCKET_ID]", fileId: "[FILE_ID]");
but this time, I get result=null, and it’s the same thing for: GetFileView, or GetFileDownload. Please help, I’m struggling, I would like to use GetFile and GetFilePreview, all the files are jpg images, and under 5mo. Thanks a lot
In general, how do you handle images in your tech stack?
before appwrite, i was using sql server, putting images directly in the db, now, i tried to use var storage = new Storage(client); File result = await storage.GetFile( bucketId: "[BUCKET_ID]", fileId: "[FILE_ID]"); byte[] file = Encoding.UTF8.GetBytes(result.Content); //here the problem, no content if (result != null) using (MemoryStream stream = new MemoryStream(file)) { Image image = Image.FromStream(stream); picDocument.Image = image; }
and with this : var storage = new Storage(client); byte[] result = await storage.GetFilePreview( bucketId: "[BUCKET_ID]", fileId: "[FILE_ID]"); if (result != null) //result is always null { Image image = Image.FromStream(stream); picDocument.Image = image; }
thanks for your help
Any help please, I'm struggling, thanks
before appwrite, i was using sql server, putting images directly in the db,
And then?
please also make sure you format multiline code with backticks like you would in markdown
Recommended threads
- Redis with user/pass doesn't work NO_AUT...
When trying to externalize my redis to a valkey server, i saw the user/pass doesn't work. After looking the appwrite code, i saw some of the init does not pass...
- Export, Import or Migration giving this ...
As you can see in yhe screenshot i am not able to export any data or export the data from tables. Also it is affecting the migration from appwrite to appwrite h...
- Project auto-blocked after load testing ...
Hi team 👋 My project has been automatically blocked with the message: "Project is currently blocked — Access to this project is restricted. Contact support if...