real-time uploading of zip files to Firebase via URL

https://i.sstatic.net/lIZip.png

I am struggling to generate the same type of URL (as shown in the picture) for my file in Realtime Firebase database. Creating JavaScript code is proving difficult for me.

Answer №1

If you're using a script to upload files, you'll need to fetch the download URL from the reference. You can achieve this by utilizing Firebase web methods in JavaScript code.

// Upload the file to storage
var uploadTask = storageRef.child('images/rivers.zip').put(file)
// Retrieve the snapshot of the storage upload and obtain the download URL
.then(snapshot => snapshot.ref.getDownloadURL())
// Store the download URL in the realtime database
.then((downloadURL) => {
    firebase.database().ref('files/' + FileID + '/url'.set(downloadURL);
    })
.catch(console.log());

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Exploring the process of gathering information using Node.js' http.request

I am currently facing a challenge where I need to call a REST API URL in one method and then use the response from that call to form a subsequent query to another URL, let's say git, to fetch some information. Despite browsing through several examples ...

Combining several files into a single variable to encode

I'm encountering an issue with the multiple file upload option. Even though it shows that 2 files have been uploaded, when I try to print the encoded value in the console, it only encodes and takes the value of my last uploaded file. How can I encode ...

Exploring the implementation of Javascript, HTML, PHP, and Ajax in programming

<div class="navigation"> <a class="prev" href="index.php?month=__prev_month__" onclick="$('#calendar').load('index.php?month=__prev_month__&_r=' + Math.random()); return false;"></a> <!-- <div class="title" & ...

Getting the entire data block in ReactJS: A step-by-step guide

I have encountered an issue with a component I created that only displays the value of block[0], rather than showing the entire block value. For instance, if I input: HI Stackoverflow It only shows "HI" and not the complete content of the field. Is th ...

HTML and CSS site lacking responsiveness

I am new to HTML and I have created a page that looks good on desktop, but it is not responsive on mobile devices. Can someone please help me with my HTML and CSS code? .link-menu { color: black; } .topbar-p ...

How to disable specific multiple dates in Material-UI datepickers?

Is there a way to disable specific dates on the calendar, not just past or future dates? I want to be able to choose which dates are disabled, such as June 29th, June 27th, and July 4th. I know you can use 'shouldDisableDates' to achieve this, b ...

Which jquery version is the best fit for my script?

I wanted to figure out which version of jQuery I am using based on a script that my friend wrote for me. Unfortunately, he is on holiday and I can't reach him. I included the following code within my body tag and called it below: $(document).ready(f ...

Tips for managing submitted data to a server in express?

In the process of sending a post request from my index.js to app.js upon a click event, I have the following code snippet: var data = { name: "Sarah", age: "21" }; var xhr = new XMLHttpRequest(); xhr.open("POST", "/", true); xhr.setRequestHe ...

The added class is not being successfully applied to the ClassList

I'm currently working on a page where I want the colors of a button and the background to switch when the button is clicked. document.querySelector("body.light").classList.toggle("dark"); document.querySelector("button.dark").classList.toggle("light" ...

Efficiency in Javascript coding techniques

Hey there, I'm seeking some feedback on the efficiency of my aspect ratio function. This function is designed to determine the aspect ratio and limit the size of an image. Take a look and let me know what you think! function constrainTwoNumbers(optio ...

Is evaluating student programmers' code with eval() a security risk?

In this unique Express app setup, I have implemented CodeMirror to provide student programmers with a platform to write code in a more enhanced way than a simple textarea. By utilizing eval() function, I evaluate the code inputted by the students in order ...

Comparing Ember.js yield with Sails.js and Handlebars in a Single Page Application (SPA) approach

I am looking to achieve a specific functionality that is typically done in Ember with Handlebars, but I want to accomplish it using only Sails.js and Handlebars. To set up my Sails project, I used the following command: sails new fooProject --template=han ...

Running tests in JavaScript that are similar to Python's doctests

Are there any JavaScript testing frameworks that offer a similar functionality to Python's doctest? function multiply(x, y) { /** Returns the product of `x` and `y`: > multiply(4, 3) 12 The function handles string inputs by convert ...

Missing information in input field using JQUERY

I've been attempting to extract a value from an input tag, but all I keep getting is an empty string. Upon inspecting the frame source, it appears as follows: <input type="hidden" name="" class="code_item" value="00-00000159" /> In order to re ...

Is there a way to use jQuery to retrieve the date and time from a timestamp within an input field?

Hey, I've encountered an issue with jQuery and the UI date picker. Currently, my NEW event form has 3 fields: Date, timeFrom, timeTo. In my SQL database, I have corresponding fields: Date(datetime), timeFrom(time), timeTo(time). When a user selects ...

Stepping inside the realm of object-oriented programming, one might wonder how to initialize an object

I wrote this user.js function but I am having trouble creating an instance of it in another file. It seems like the structure is a function that contains a class which has functions within it. user.js 'use strict'; const {Sequelize} = require(&a ...

choosing a specific element with jQuery to be used for future purposes

I'm having some trouble with the following code snippet: var star = $("._container > favorite"); var symbol = $(star.parentNode.parentNode).attr("symbol"); var exchange = $(star.parentNode.parentNode).attr("exchange"); After running ...

Dealing with the challenge of sorting and editing one div at a time

I'm encountering an issue with my script where the input textbox becomes uneditable when I use sortable for a div element. In my code, I have drag and drop functionality where after dropping, the div should be sortable and the input should be editabl ...

Issues with navigation menus in Bootstrap/Wordpress

My mobile drop-down menu is giving me some strange issues. When you toggle the button, the menu briefly appears just below the button before moving to its correct position. Sometimes it doesn't work at all, and clicking has no effect. You can witnes ...

Creating custom shaders in three.js that can receive shadows involves a few key steps. Let

For more information, you can visit the original post here. The task at hand seems to be quite complex due to the lack of documentation and examples on this specific topic on the three.js website. Currently, I am able to render the correct image and, with ...