
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
- Invalid credentials after migration
Hi everyone! After migrating our self-hosted Appwrite 1.3.1 to another server (staging, so a different domain), we are now getting 'Invalid credentials' when ...
- implement caching
It it possible to cache response for few minutes? I dont want to create function or implement a whole reverse server just to cache it in somewhere ?
- Invalid redirect url
I keep getting invalid redirect url in Nextjs when i try to use google or github authentication
