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
- Clean install of 1.9.0 shows errors in a...
I just run a full clean install of Appwrite on my server following the Manual installation guide in the docs page. The console seems to work, visually there d...
- Setup custom domain on selfhosted behind...
Hello everyone, can anyone help me to setup a custom domain on a selfhosted appwrite instance thats running behind cloudflare tunnels? Current setup: Appwrite r...
- Why does this happen?
`AppwriteException: general_argument_invalid, Invalid `secret` param: Value must be a valid string and at least 1 chars and no longer than 256 chars (400)` the...