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
- Error getting preview of file
Rest Response: ``` { "message": "Server Error", "code": 500, "type": "general_unknown", "version": "1.8.1" } ``` Appwrite Logs ``` appwrite ...
- Storage images using custom domain retur...
Some of the images uploaded to my storage bucket returns this error: ``` { "message": "Project with the requested ID could not be found. Please check the value...
- Bandwidth limit for your organization ha...
I received an alert that I exceeded the Free plan bandwidth limit (showing 5.86 GB), but my dashboard tells a different story. The usage stats there are much lo...