Uploading Files to Firebase DB

I am aware about about Firebase Storage Extensions, but is there a method to upload and retrieve files (specifically PDF) through MIT App inventor. I want to use firebase realtime db for it.

Is there a method to upload the files to some we server or directory and save the link in firebase DB? Or can we convert the files to 64 base form and save it in DB?

Please tell how to do it. Any method would work, but I have to just store the files in firebase DB and also retrieve them using app.

You would need to convert the pdf files to a base64 string in order to store them in the realtime database, and then decode the base64 string to a file when you retrieve it. Not efficient. Use Firebase Storage for files, and realtime database for data.

If you do not want to use an extension for firebase storage, then use the web component:

Thanks, will try. But, can you please tell what to put in the 'path'. The file is not stored on my device. So, how can I define its path?

When a person logs in, he can upload his file to the firebase storage through the app, but how will this path of file be defined in the code?

Download the file to the device first, then upload from the device to Firebase Storage, you can automate this.

I was facing the same problem with your extension @TIMAI2 . The path thing is bit confsuing to use.

@TIMAI2 Can you explain how to automate?

Not an extension just blocks coding....

Which part is confusing you?

Once the file is downloaded to the device, you can initiate the upload to Firebase Storage.

Let me place it clearly. When the user logs in the app, he can upload a file using filepicker. Now, you are saying I will have to download the file in my device, and then the app will post the dile to the web component into the storage. But, how will this process of getting the files on my computer be automated?

But, can't this process be automated?

You said:

I took this to be stored on another server somewhere.

If the file is on the device, preferably stored in the ASD so that your app can access it, then provide the correct file path to upload it to Firebase Storage.

The file is not in my device. My question is when a user picks a file on the app, how can it automatically get downloaded in my device?

How can this automation be brough with the part of downloading the file the user picked in the app, into my device so that it can be easily uploaded to the fb storage?

Basically, I am asking how to do is?

Follow my guide, put some blocks of your own together, come back if you get stuck.

Thanks, I read your guide and now have put everything in place.

Just, one more thing. Is there a method to display the file downloaded from the FB Storage in the app itself? Like some PDF viewer extension or something? Image can be displayed using the Image component, but with PDF's I am actually stuck.

You could try this:

There are several other PDF viewing extensions (mostly [PAID])


This is my code for getting the file from the FB Storage.

But, I am getting this error
image

@TIMAI2 please help

You indicated that the pdf was downloaded first. ViewPDF will work for "local" files only, not urls.

Oh ok fine