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
- 1:1 relationship doesn’t sync after re-a...
Hi, I’m trying to use a two-way one-to-one relationship. It works fine when I create a record with the relationship set, and it also works when I unset it. But ...
- Upsert with setting permissions
Hi there, I am using self-hosted appwrite v1.7.4 and trying to use the bulk update stuff that was released with 1.7.x. Unfortunally I found that there is an ser...
- Github connection error - Self Hosted Ap...
I am trying to connect my github account to deploy a project to sites, but Connect to Gtihub button is disabled. I have configured all Env variables needed for...