Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Nov 2011
    Location
    South Africa
    Posts
    60
    Thanks
    14
    Thanked 0 Times in 0 Posts

    view a list of uploaded pdf files

    I am building a site where the user can upload pdf files, I have this bit coded but how can I display the PDF filename and link in a table. I think I can do this with php, and json but i'm not sure how to do it so any help would be great.

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,531
    Thanks
    8
    Thanked 1,091 Times in 1,082 Posts
    Try this basic script to get you started ...

    save it as "list.php", and then include it in your .php web page.

    Example, this line in your main page called 'index.php' ...

    <?php include("list.php"); ?>


    PHP Code:

    <?php

    // folder name where they are stored.
    $folder_name="files";

    // put these types of files into an array.
    $myFiles array_merge(
    glob("$folder_name/*.pdf")
    );

    foreach(
    $myFiles as &$file){
    echo 
    "<a href='$file' target='_blank'>$file</a><br />";
    }
      
    ?>

  • Users who have thanked mlseim for this post:

    helen11 (12-08-2013)


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •