I am trying to upload file to appwrite storage, but it's not working, I tried with the 2 following codes:
Code1: using InputFile:
const { Client, Storage, InputFile } = require('node-appwrite');
const filePath = './path/to/your/file.txt'; // Local file path
const fileName = 'uploaded-file.txt'; // Name to assign to the file in Appwrite
const file = InputFile.fromPath(filePath, fileName);
const fileUploadResponse = await storage.createFile(
process.env.APPWRITE_STORAGE_QRCODES,
'unique()',
file
);
Code2: using createReadStream:
const { Client, Storage, InputFile } = require('node-appwrite');
const file = fs.createReadStream(qrCodeFilePath);
const fileUploadResponse = await storage.createFile(
process.env.APPWRITE_STORAGE_QRCODES,
'unique()',
file
);
related issue: https://appwrite.io/threads/1250841985699287143
Can I ask what error messages you are receiving? Also, have you taken a look at the storage api reference docs for createFile? https://appwrite.io/docs/references/cloud/server-nodejs/storage#createFile
Recommended threads
- Sites: Auto deploy on wrong github repos...
Hello, I have kinda with UAT(testing env) and prod env. When i pull request from dev -> uat, which stands as pre-prod environment to fully test all functionalit...
- Generate CSR
How do I generate a CSR for my domain host? They are asking me to generate one for my hoosting here on appwrite
- Appwrite Push Notifications: "Unknown er...
Hi all, I'm running into an issue with Appwrite push notifications in my web project. When I try to manually send a notification to a user from the Appwrite we...