Put file/image to my POD

I’m trying to put an image to my personal(with react) pod but I don’t understand how to do it.
I wrote a function that creates a document with these parameters: uri, base64 data, type.
But I can’t view it on my pod.
Sorry for my bad English and for the stupid question.
Thanks in advance.

ps: These are my functions:
"
try{
var reader = new FileReader();
reader.onload = async function(event) {
//console.log(creatore);
const gridPath = await storageHelper.getAppGridStorage(creatore);
var postStore = ${gridPath}post/;
var postPath = postStore + fileInInput.name;
console.log("[]PathImg: " + postPath);
var data = event.target.result;
//console.log(data);
//var data = data.replace(“data:image/png;base64,”, “”);
//console.log(data);
console.log(fileInInput.type);
await storeImageToPod(postPath, data, fileInInput.type);
};
reader.readAsDataURL(fileInInput);
console.log("[
]Fine visualizzazione file.");
}catch(e){
console.log(e);
}
"
and
"
export const storeImageToPod = async (documentUri, body = ‘’ , tipo) => {
try {
return createDoc(documentUri, {
method: ‘PUT’,
headers: {
‘Content-Type’: tipo
},
body
});
} catch (e) {
throw e;
}
};
"

With Solid-File-Client all of that can be accomplished with

  fileClient.copyFile( 
    "/someLocalPath/foo.png", "https://myPod/public/foo.png"
  )
1 Like

Thank you! now i try to use your suggestion!

That example works on the command line in a nodejs script. To use it in a browser see this example: https://jeff-zucker.github.io/solid-file-client/docs/examples/

1 Like

I see the code of the example and now it works perfectly. Thanks again!

2 Likes