App Write Invalid URL Error
Hello friends, hope you all are doing well. This post will be short and straight forwarded regarding this problem when it comes to add a file to the Appwrite bucket. The approach is kind of naïve since I followed the documentation straight forwardly.
Before moving on forward here is my project directory structure , accordingly explains how I did set up my path.
Keeping reference to this directory structure. The code will be as follows. This is just a piece of code from the documentation but this where the things mostly go wrong. So the format is pretty much like this.
const result = await storage.createFile(
'<BUCKET_ID>', // bucketId
'<FILE_ID>', // fileId
InputFile.fromPath('public/temp/filename.extension', 'filename.extension'), // file
["read('any')"] // permissions (optional) If you omit this then make sure
// you have provided some permission in your bucket settings
);
If beyond this an error comes up stating that user is not authorized to perform this or that operation then make sure to provide permission in your bucket settings of appwrite.
Thats it ! and I hope this will do the job for you and this post might be the last stop for your search.
Happy coding 😄
Subscribe to my newsletter
Read articles from Neelesh Joshi directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Neelesh Joshi
Neelesh Joshi
Hi, am a passionate programmer and front-end web developer I am interested in problem solving