我有以下代码在firebase存储中上传文件:
if ($('#arquivo')[0].files.length > 0){
file = $('#arquivo')[0].files[0];
var metadata = {
contentType: 'image/jpeg',
};
var uploadTask = imagesRef.child('documentos/' + file.name).put(file, metadata);
uploadTask.on('state_changed', function(snapshot){
console.log('state changed')
//console.log(snapshot)
}, function(error) {
console.log('error')
console.log(error)
closeLoader();
}, function() {
console.log('arquivo uploaded')
downloadURL = uploadTask.snapshot.downloadURL;
documento.arquivo = downloadURL
documentosRef.child(keyDocumento).update(documento);
window.location = "/documentos?estado=updated_success";
});
}
我希望这些文件只有扩展名doc,docx,xls,xlsx,txt,ppt,pps和pdf文件
我怎么能这样做?