1

I'm doing android native app that needs to shown up all the files & folders from server end PC using login credentials & IP address.On that i can able to do some stuff over there(like copy,move,delete).I dont have any experience regarding this.How could i startup this?Give some idea.

Thanks

sanjay
  • 2,590
  • 17
  • 55
  • 88
  • Any example codes are there.That will help me a lot – sanjay Jun 01 '12 at 06:36
  • @Lucifer Oh okay. Thanks for your information. I'll keep this. – Praveenkumar Jun 01 '12 at 06:38
  • Please have a look at [here](http://www.technotalkative.com/android-json-parsing/) and [here](http://p-xr.com/android-tutorial-how-to-parse-read-json-data-into-a-android-listview/) – Praveenkumar Jun 01 '12 at 06:40
  • But is it possible to get files as directory from server as JSON? For ex.in server i have a drive with some folders.inside each folder i have some files.through my android app, can i get all folders using JSON? – sanjay Jun 01 '12 at 06:44

1 Answers1

0

Make a request over http to your server and encode the server response in JSON format and parse the response with the JSONObject class.

Server-side example with PHP to list files in a directory

$file_id = 0;
$files = array();

if ($handle = opendir('/path/to/files')) {

    while (false !== ($entry = readdir($handle))) {
        $files[$file_id] = $entry;
        $file_id ++;
    }
    echo json_encode($files);
    closedir($handle);
}
  • Thanks.i can get data as values from server using JSON.But my question is that is it possible to get data as entire folders from server and able to parse? – sanjay Jun 01 '12 at 06:47
  • i dont want to download files from server.I just want to show up all files & folders of server from my android app.(I have permissions & credentials to access server) – sanjay Jun 01 '12 at 06:56
  • What server-side language are you using? –  Jun 01 '12 at 06:59
  • i used server side language as Php – sanjay Jun 01 '12 at 07:06