How to get all files and folders listed in my ionic app like dropbox?


#1

I have my server where i have uploaded all files and files within folders.i want to create app that let me see what’s on my server and i also want to down download those files from ionic app?
Is there any way using ionic 2?


#2

I think you can use Ionic Component to have some ideas for your App, more specifically the list component to show the files from the server (but first you need to catch this data from the server). And for download and upload an file take a look on Transfer, it is a very useful plugin


#3

Actually i have used ionic components but my problem starts with fetching all those files and folders from server with download link.
Does ionic provide any solution for that?


#4

How could it? All it can do is make HTTP requests. It’s up to you to make your server respond to some of them with lists of files and folders.


#5

@ravisojitra

I’m not an expert with http service, but it should go down to these basic operations:

  1. make sure your app globally import well http service (app.module.ts file)
  2. in the page.ts you want, import http service in constructor

export class ExamplePage { 
...
constructor(public navCtrl: NavController, public http: Http) {

    // Then initialize something with http service
    this.MyFutureHttpFileLoad = this.Http;
   // test it to see if it's not null at start of page
    console.log (this.MyFutureHttpFileLoad);
    //then ..
    }
...
}

After in your .ts file associated with a click button to test in ExamplePage.html, you would do a simple TypeScript code like this:

MyClick() {

this.myDisplayOfObject = this.MyFutureHttpFileLoad;
console.log (this.myDisplayOfObject);
//then a map.res on it
this.MyDisplayOfObject.map(res => res.json()).subscribe(data => {
    console.log(data);
});

// and if my code is right you have a good kickstarter!
}

Hope it helps :slight_smile: