Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

153
Views
Firebase Storage - upload with only 9B

Iam trying to send files to Firebase storage in my JS file (.png) it looks fine, but when I look into the repo, the file is a 9B (corrupted??). I read the Google doc many times, but I didn't realize what Iam doing wrong, please HELP.

My input on the html...

<input name="foto aluno" id="photo" type="file"/>

My JS:

document.getElementById('photo').addEventListener('change', handleFileSelect, false);

var handleFileSelect = function(e){
    e.stopPropagation();
    e.preventDefault();

    var file = e.target.files[0];
    var storageRef   = top.firebase.storage().ref();

    console.log(file);

    var metadata = {
        'contentType': file.type,
        'contentLength': file.size
    };

    storageRef.child('/imagem' + file.name).put(file, metadata).then(function(snapshot) {
        
        console.log('Uploaded', snapshot.totalBytes, 'bytes.');
        console.log('File metadata:', snapshot.metadata);

        snapshot.ref.getDownloadURL().then(function(url) {
          console.log('File available at', url);
         
        });
      }).catch(function(error) {
        console.error('Upload failed:', error);
    });
};

and finally, the result in firebase9B picture

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!