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

562
Views
Upload expo file error (Error: Location isn't readable)

I am trying to upload a pdf file using uploadAsync in expo fileSystem based on this documentation(https://docs.expo.dev/versions/latest/sdk/filesystem/#filesystemuploadasyncurl-fileuri-options). But what I get is an error [Error: Location 'sample location' isn't readable.]

my code is

const [doc, setDoc] = useState();

const _pickDocument = async() => {

        let result = await DocumentPicker.getDocumentAsync({type:'*/*', copyToCacheDirectory:true, multiple:true})
        .then(response=>{
            if (response.type == 'success') {          

                let { name, size, uri } = response;
                let nameParts = name.split('.');
                let fileType = nameParts[nameParts.length - 1];
                var fileToUpload = {
                  name: name,
                  type: mime.getType(fileType),
                  size: size,
                  uri: Platform.OS === 'ios' ? uri : "file://"+uri
                };
                console.log(fileToUpload)

                setDoc(fileToUpload);
               console.log("FileSystem.documentDirectory")
               console.log(FileSystem.documentDirectory)
               console.log("============================")

            } 
        })
        .catch(error=>{
            console.log(error)
            throw error
        })
    }
 const submitDoc= async()=>{
        const url = "upload.php";

         const upload = await FileSystem.uploadAsync(url,doc.uri,{
             headers:{'content-type': 'multipart/form-data'},
             httpMethod:'POST',
             uploadType:FileSystemUploadType.MULTIPART,
             fieldName: doc.name,
             mimeType:doc.type
          });
         console.log(upload);
          } 

Is there a way to solve this? Thank you.

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!