Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File (.pdf) path directory doesn't exist error if I select file (.pdf) from mobile download folder in ionic. #51

Open
pradeep531 opened this issue Dec 17, 2022 · 0 comments

Comments

@pradeep531
Copy link

I everyone,
I want to upload the pdf file on our server using the file-chooser Cordova plugin. I had success in the file selection but after the file selection I tried to upload on the server but received the error "directory doesn't exist".

`var filter = { "mime": "application/pdf" };
this.fileChooser.open(filter)
.then(url => {
console.log('fileChooser:',url);
this.filePath.resolveNativePath(url)
.then(filePath => {
console.log('saif file pathhh',filePath);
let correctPath = url.substr(0,url.lastIndexOf("/") + 1);
let currentName = filePath.substring(filePath.lastIndexOf('/') + 1);

          this.file.checkDir(this.file.externalDataDirectory, correctPath).then(_ => console.log('Directory exists')).catch(err =>
            console.log('Directory doesnt exist'));

            
          
          let _filePath = filePath;
          let resPath = this.pathForImage(_filePath);

          let newEntry = {
            name: currentName,
            path: resPath,
            filePath: _filePath,
            comparessedPath: _filePath,
          };

          this.startUpload(newEntry, index, field_id);


      })
      .catch(err => console.log('saif file pathhh errorrr',err));
  })
  .catch(e => {
    console.log('saif file pathhh errorrr catchhh',e);
  });`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant