$fname, 'filename' => $fname); } } else if (substr($rid, 0, 5) == "local") { //local file has files in localstore $fnames = getLocalFilelist($rid); foreach ($fnames as $fname) { $flist[] = array('id' => $fname, 'filename' => $fname); } } else { // if resource in waramu $w = waramu_get(); $ats = $w->listAttachments("", $rid); foreach ($ats['attachments'][0]['attachment'] as $at) { $fid = $at['id'][0][0]; $fname = $at['filename'][0][0]; $flist[] = array('id' => $fid, 'filename' => $fname); } } $flist = json_encode($flist); echo($flist); ?>