Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/406.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用javascript将多个文件上载到firebase存储时提供帮助?_Javascript_Firebase_Firebase Realtime Database_Firebase Storage - Fatal编程技术网

使用javascript将多个文件上载到firebase存储时提供帮助?

使用javascript将多个文件上载到firebase存储时提供帮助?,javascript,firebase,firebase-realtime-database,firebase-storage,Javascript,Firebase,Firebase Realtime Database,Firebase Storage,通过这种方式,我将文件加载到firebase存储中,并将url添加到变量中。如果需要,如何添加多个文件 var url2 = document.querySelector("#photo").files[0]; const ref = firebase.storage().ref('doc_conductor/'+numberDocument); const file = document.querySelector("#photo").fil

通过这种方式,我将文件加载到firebase存储中,并将url添加到变量中。如果需要,如何添加多个文件

var url2 = document.querySelector("#photo").files[0];


  const ref = firebase.storage().ref('doc_conductor/'+numberDocument);
  const file = document.querySelector("#photo").files[0];
  const name = + numberDocument + "-" + file.name;

  const metadata = {
    contentType: file.type
  };
  const task = ref.child(name).put(file, metadata);
  task
    .then(snapshot => snapshot.ref.getDownloadURL())
    .then(url => {

      url2 = url;

      db.collection("drivers").add({
        url: url2
      })
只需多次调用
put()
,每个文件一次?