i’m writting an app that allows the user to add files to a pod. I started with the tutorial given on Solid. But i don’t understand why i cant upload file.
here is the error i get :
Error uploading file: TypeError: _solidClient.putFile is not a function
i just copied and past all the tutorial code (Getting Started · Solid) and added this function to javascript :
If someone can explain me why it doesnt work and how i can correct it. And maybe if you have some link to help me, because the second steps of my project is to develop a way to explore those data and order it.
Which tutorial are you following, and what library are you using? Someone familiar with those might be able to help, but then they have to know that that is what you use
I also asked “chatGPT” if this function exist and it’s in inrupt lib :
This code imports several functions from the @inrupt/solid-client library, which is a package in the Solid React SDK for accessing and manipulating Solid data:
getSolidDataset: retrieves a Solid dataset from a given URL
getThing: retrieves a resource description as a Thing object from a Solid dataset
setThing: sets a Thing object as the description of a resource in a Solid dataset
getStringNoLocale: retrieves the value of a property in a Thing object as a string without a language tag
setStringNoLocale: sets the value of a property in a Thing object as a string without a language tag
saveSolidDatasetAt: saves a Solid dataset to a given URL
putFile: uploads a file to a Solid Pod at a given URL
These functions can be used to create Solid apps that interact with the Solid ecosystem. Make sure you have installed the @inrupt/solid-client package and added it as a dependency to your project before using these functions.
But maybe i’ve missed something. I’m just trying to upload a file on a pod. If you have another function to upload it could be nice
That links goes to a library called solid-file-client, which is different from @inrupt/solid-client (yes the naming is confusing). ChatGPT doesn’t actually know things, it just generates convincing language, so please do not take that for gospel.
Inrupt JavaScript Client Libraries — Inrupt JavaScript Client Libraries is generally the best reference for using those libraries, yes. I expect that you’ll need to make some additional modifications, but I suggest just giving it a shot and see where to go from there. The main thing you’ll need, just like in the rest of the initial tutorial you followed, is to pass in your session’s fetch function.
so in my code i just have to replace putFile with the function overwriteFile() ?
I think you have found the right documentation page. If your intent is to write a non-RDF file (like a text document, a picture) at a given IRI in your Solid Pod, then overWriteFile from @inrupt/solid-client should do what you need. Note that you’ll most likely need to pass in an authenticated session (as described in the doc page you linked to), unless the place you’re writing to allows public write.