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

287
Views
How to upload document files (pdf,doc) to firebase in react native expo

i am trying to upload doc files from expo cli to my firebase storage in react native but it gives me network error.

i use document picker to get file uri from storage and then i use this function to upload it to my firebase storage.

const uploadDocuments = () => {
    let recievedDocs = [];
    document.map(async (item, index) => {
      var docName = user.uid + Math.floor(Math.random() * 127212);
      const response = await fetch(item.uri);
      const blob = await response.blob();
      var ref = firebase.storage().ref("postDocs/documents/" + docName);

      ref
        .put(blob)
        .then((res) => {
          ref
            .getDownloadURL()
            .then((url) => {
              recievedDocs.push(url);             
            })
            .catch((e) => {
              alert(e.message);
            });
        })
        .catch((e) => {
          alert(e.message);
        });
    });
};

i also use this function to upload images to firebase storage from image picker and its work fine there but when i use this same function for docs file uri that i get from document picker to upload its give me network error

here is error that i get.

[Unhandled promise rejection: TypeError: Network request failed] at node_modules\whatwg-fetch\dist\fetch.umd.js:535:17 in setTimeout$argument_0 at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:130:14 in _callTimer at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:383:16 in callTimers at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:416:4 in __callFunction at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:109:6 in __guard$argument_0 at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:108:4 in callFunctionReturnFlushedQueue

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!