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;
}
};
"