Upload, store and load image

Is there a way to store picture in SafeNet? Recently I know how to keep some text data using _public container, but how does the picture work? Hope there is an example application or guide that can let me refer…

Search for NFS emulation

1 Like

Jack - have a look in here:

David.

2 Likes

I’m sorry but I really not familiar with using APIFunction.then() style.

I follow the step by step guide. In step 1, it’s creating app_info and initialise. Follow by step 2 and it says appHandle is not defined. Even if I assign the return value to a variable call appHandle like this
image

It shows error of Uncaught (in promise) Error: Invalid handle: [object Object]. Am I missing something?

Is there a simple webpage/webapp that is published that I can refer to store image?

I think you need to read up on how to use Promises.

The problem here is that the initialise() returns a Promise immediately, it doesn’t wait on the then() which explains the unresolved Promise error.

If you put a console.log(res) inside the handler you will see the appHandle is valid there (assuming the appInfo is correct).

It takes a while to get the hang of this.

Alternatively you can use await but there are dragons there too which still catch me out!

1 Like

Previously I am learning through safe://checklists created by @drehb which using javascript only…
I am able to deal with the text but now my webpage needed to provide user upload the image and this is where I stuck…

It is a time ago I looked into it, but maybe the links below could help you:
https://developers.google.com/web/fundamentals/primers/promises
https://hackernoon.com/6-reasons-why-javascripts-async-await-blows-promises-away-tutorial-c7ec10518dd9
https://github.com/wardbr/Safe-todo-draw/blob/master/src/js/safe.js

2 Likes

@draw Is the safe-todo-draw published? What is the URL to access it?

The url is safe://todo and you should be able to see the same as safe://checklists if I’m not mistaken.

3 Likes

I saw that you have another published webpage which is safe://optomoon.draw that upload videos. Do you have the implementation file for that as well? Like how you created, upload image and finally upload to the network. That will really help me alot!

No, that is just a simple site with a reference to a video. You can’t upload videos with it.
EDIT: I’ve uploaded it with the webhosting manager, that you can download here:


But you could also try instead: safe://vidy, safe://safefs.webapp or safe://blog.safecms/

2 Likes

I’m not referring to uploading video through the site. I just want to know how you upload the video to the network as the reference to your site and how you upload the site to network as well.

1 Like

You just need to setup your website as any regular static site and upload all the files together with the webhosting manager.

2 Likes