is there a new way to upload a file via NFS with the window.safeNfsFile functions?
Also to insert an entry in a public Mutable Data Structure with Insert enabled for everyone you can’t use an unauthorised connected session, it needs to have requested permissions even if it has nothing to do with inserting an entry. Safe Chat uses '_public': ['Read'] anytime a user wants to actually post a message.
Hi @Joseph_Meagher, can you please share the snippet you are using for this? Also, are you running into this issue with mock or with the Test18?
Yes, remember that to write content in the network you need PUT credit, and that’s associated with an account, that’s why you need to connect authorised.
This is a bug which was recently fixed, so it will be solved in our next release of binaries.
I was using the default functions in safe API Playground in this order on Testnet 18:
initialise
authorise
connectAuthorised
newrandompublic
getNameandTag
emulateAs NFS
create
insert (fails here)
@Joseph_Meagher, you are just missing the step to commit the MD you are creating to the network before calling the emulate as NFS, i.e. make sure you call quickSetup right after you call newRandomPublic, that should do it.
It’s good that you uncovered this though. The web API playground let you go on as if nothing was wrong, even though you didn’t put the MD to the network. I’ll look into making the playground more informative and instructive.
The file explorer is working for me, but I think the filesize snippet has a small problem. The second filesize should be fileSize
return window.safeNfsFile.size(fileContextHandle)
.then(fileSize => {
return 'file size in bytes: ’ + filesize;
})
Thank you for finding the typo and for confirming that the FileReader API is working on your system. I was reading about obscure FileReader issues on browsers running on particular versions of Windows 10.