Back

Is Storage.updateFile missing a file argument?

  • 0
  • Web
saricden
5 Jun, 2023, 16:16

So far as I can tell Storage's updateFile function appears to be missing an argument to actually pass a file?

If it's not meant to update a file from one file to a new one what does this function do?

It's not clear to me from the docs <:thonk:617026528424886275>

TL;DR
The user is questioning the functionality of the Storage.updateFile function in the Appwrite app. They note that there is no argument to pass a file and are unsure of what the function is supposed to do. Another user suggests that the function is for updating file permissions, not changing the file content. If the user wants to upload a file, they should use the createFile function instead. No solution is provided in the thread.
Binyamin
5 Jun, 2023, 16:18

To upload a file use the createFile function. https://appwrite.io/docs/client/storage?sdk=web-default#storageCreateFile

The updateFile is for updating the file permissions. not for changing the file content.

saricden
5 Jun, 2023, 16:19

Ohhhh

saricden
5 Jun, 2023, 16:19

@Binyamin it might make more sense to call the function updateFilePermissions or something in that case.

saricden
5 Jun, 2023, 16:19

I read updateFile as "take an existing file and replace it with a new one"

saricden
5 Jun, 2023, 16:20

And the description in the docs just says this:

TypeScript
Update a file by its unique ID. Only users with write permissions have access to update this resource.
Binyamin
5 Jun, 2023, 16:21

I get you, it does sounds like you're updating the file itself.

saricden
5 Jun, 2023, 16:21

Yee

saricden
5 Jun, 2023, 16:21

πŸ€·β€β™‚οΈ

Binyamin
5 Jun, 2023, 16:21

Also, I went over the code and that function its 100% permission related.

Binyamin
5 Jun, 2023, 16:22

That sounds like something you can open issue here

Drake
5 Jun, 2023, 16:38

ya, but this allows us to use this endpoint for other things in the future...like maybe updating the file name

Binyamin
5 Jun, 2023, 16:39

That's what I've thought So, it's more general function but - for now - just permissions

manazo
19 Aug, 2023, 17:30

can i get the code link?

Binyamin
20 Aug, 2023, 17:20

Sure thing

Binyamin
20 Aug, 2023, 17:20
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more