Simple way to compile external linked files

Discussion in 'Web Design and Development' started by chrispholt, Sep 1, 2012.

  1. chrispholt macrumors regular

    Feb 6, 2010
    Cheddar, UK. Yes where the cheese comes from..

    I was wondering if anybody could help me with a website I am making. I am quite capable of making websites (fairly simple ones) but know nothing about php and databases etc.

    I have this test page, and under the sub-heading "Pastpapers" there are is a listed of linked .pdf documents.

    My website basically links documents from other websites, making it easy to access.


    Is there an easy/simple way for me to make a download all button (like already on the site) compile all of the linked files into a .zip and then be presented as a download to the user. I will be making the website in a fairly "manual" manner, without databases.

    So is there a way to make some sort of php script download all link files in one div or something? (complete long shot)

    Any tips will be appreciated.

  2. SrWebDeveloper macrumors 68000


    Dec 7, 2007
    Alexandria, VA, USA
    You asked for simple, so I assume you only need the code necessary to create the zip archive and set the headers to start the download on the fly. Meaning, you know how to get the list of documents to add the zip.

    Read that page and all comments there, download the source there and once you create your list pass it to the function something like this:

    That's pretty damned simple.

    Up to you to add sensible code to deal with issues such as multi-user or sessions, checking paths, permissions, dealing with thousands of files, etc.

    Note: PHP 5.2.0 or later to avoid installing a library to support ZIP


Share This Page