Error uploading file: TypeError: Cannot read properties of undefined (reading 'fromPath')
- 0
- Storage
Hi, I am trying to upload the file, but I an unable to do so.
Kindly assist
const uploadFile = async (filePath) => { try { if (!fs.existsSync(filePath)) { throw new Error("File does not exist: " + filePath); }
// console.log(fs.readFileSync(filePath));
// ("/fix");
// Upload file with InputFile
const resultUpload = await storage.createFile(
"__",
ID.unique(),
InputFile.fromPath("./images.jpeg", "images.jpeg"),
[
Permission.read(Role.any()),
Permission.update(Role.users()),
Permission.delete(Role.users()),
]
);
console.log(resultUpload);
// console.log("File uploaded successfully:", resultUpload);
return resultUpload;
} catch (error) { console.error("Error uploading file:", error); } };
Recommended threads
- Issue with downloading large files (40GB...
Hi everyone! I am using the latest Appwrite 1.8.0 version on my self-hosted server. I successfully uploaded a large ZIP archive (~40GB) using the chunked uploa...
- Firebase app import
I'm **very** new to appwrite and I just set up appwrite with docker and I'm trying to import a Firebase app I have set up but it's erroring and I don't really k...
- getFileViewURL isnt working on android
i trid the adding the jwt token to the end of the url still nothing. but it works fine on ios https://fra.cloud.appwrite.io/v1/storage/buckets/693a0xxxxxxxxf2d...