
Hey guys. So I'm trying to upload an image using storage.createFile
. But when I run it, it throws source.on is not a function
. Below is what my function looks like
async function uploadAvatar(file: File, userId: string) {
const { Permission, Role } = await import("appwrite");
const { storage } = await import("@/AppwriteServices");
const { Bucket_ID } = await import("@/AppwriteServices/IDs");
await storage.createFile(Bucket_ID, userId, file, [
Permission.delete(Role.user(userId)),
Permission.update(Role.user(userId)),
Permission.read(Role.any()),
]);
}
the screenshot shows the error
Any idea what's happening?

what server version? what SDK version? Is this executed client side? how are you getting that file?

Server: Cloud Console SDK: 11.0.0 It's executing on the server side and I'm getting that file from user input

seems like you can't use the web sdk for creating a file server side like this. files in the browser are different than files in nodejs
Recommended threads
- mcp-for-docs not working properly
I'm experiencing issues integrating the MCP server tool with Cursor IDE. The MCP server connection establishes successfully initially but fails after one minute...
- Creating a relationship with nested obje...
{ "data": { "name": "DiDi", "type": "Software Development", "userJobs": [{ "$id": "68cbf1e2003612fb13ca", "j...
- Realtime integration with SSR auth
Hey, I have a nextjs website with SSR auth, works great. I use a session client for user verification and an admin client with API key. Both is used with node-...
