Get names of files attached to page
argument keys:

  • site: site with the page containing the file(s), e.g. "my-site"
  • page: page (full name) that has the file(s) attached

returns: list of file names

This demo uses the sample code below. Create a separate file in your hosted site. Change the path to the and files. Change the $cat variable to the category and page name you want to select files from. Replace the all caps USERNAME, API KEY, and SITENAME to your information.

Sample Code

//set globals before includes
    $newdebuglevel = 0;    
//add includes
//change path to your server location
//set startup parameters for xmlrpc
//change path to your server location
    $GLOBALS ['xmlrpc_null_extension' ] = true;
    $ServerPath = "xml-rpc-api.php";
    $ServerHostName = "";
    $ServerPort = "";
//create a client for your site
    $Client = new xmlrpc_client($ServerPath,$ServerHostName,$ServerPort);
    $Client->setCredentials("USERNAME","API KEY");
    $Client->return_type = "phpvals"; //forces return of page.get_one as php values
    $SiteName = "SITENAME";
////////////test code
////////////code doesn't include error checking
    $fileobj = new FilesWikidotMeta($SiteName, $Client);
    $returnarray = array();
//change $cat to the page you want to list the files
    $fileobj->php_files_select($cat, $returnarray);
    foreach ($returnarray as $files){
        echo "File->".$cat.": " . $files . "<br />";}

Download Code File

Live demo

Uses above code in an Iframe from a PHP host.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License