Download files script.

Discussion in 'Perl Misc' started by mathaios, Sep 28, 2008.

  1. mathaios

    mathaios Guest

    Hi.
    I want to install a script in my website for the visitors to be able
    to download files.
    Is there anyone who can replace the values needed to be changed in the
    script below for base downloads folder, downloads log file name,
    allowed file types
    with highlighted example text?

    ------------------------------------------------------------------------------------------------------------------------------------------
    // Allow direct file download (hotlinking)?
    // Empty - allow hotlinking
    // If set to nonempty value (Example: example.com) will only allow
    downloads when referrer contains this text
    define('ALLOWED_REFERRER', '');

    // Download folder, i.e. folder where you keep all files for download.
    // MUST end with slash (i.e. "/" )
    define('BASE_DIR','/home/user/downloads/');

    // log downloads? true/false
    define('LOG_DOWNLOADS',true);

    // log file name
    define('LOG_FILE','downloads.log');

    // Allowed extensions list in format 'extension' => 'mime type'
    // If myme type is set to empty string then script will try to detect
    mime type
    // itself, which would only work if you have Mimetype or Fileinfo
    extensions
    // installed on server.
    $allowed_ext = array (

    // archives
    'zip' => 'application/zip',

    // documents
    'pdf' => 'application/pdf',
    'doc' => 'application/msword',
    'xls' => 'application/vnd.ms-excel',
    'ppt' => 'application/vnd.ms-powerpoint',

    // executables
    'exe' => 'application/octet-stream',

    // images
    'gif' => 'image/gif',
    'png' => 'image/png',
    'jpg' => 'image/jpeg',
    'jpeg' => 'image/jpeg',

    // audio
    'mp3' => 'audio/mpeg',
    'wav' => 'audio/x-wav',

    // video
    'mpeg' => 'video/mpeg',
    'mpg' => 'video/mpeg',
    'mpe' => 'video/mpeg',
    'mov' => 'video/quicktime',
    'avi' => 'video/x-msvideo'
    );
    ------------------------------------------------------------------------------------------------------------------------------------------

    I would be greatful.
    mathaios, Sep 28, 2008
    #1
    1. Advertising

  2. mathaios

    Rich Grise Guest

    On Sun, 28 Sep 2008 03:29:26 -0700, mathaios wrote:

    > Hi.
    > I want to install a script in my website for the visitors to be able
    > to download files.


    Why not just link to it, and let them click "save to disk"?

    Cheers!
    Rich
    Rich Grise, Sep 30, 2008
    #2
    1. Advertising

  3. mathaios

    mathaios Guest

    On Sep 30, 2:46 am, Rich Grise <> wrote:
    > On Sun, 28 Sep 2008 03:29:26 -0700, mathaios wrote:
    > > Hi.
    > > I want to install a script in my website  for the visitors to be able
    > > to download files.

    >
    > Why not just link to it, and let them click "save to disk"?
    >
    > Cheers!
    > Rich


    How do i do that?
    mathaios, Oct 5, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    296
  2. Gilles Ganault
    Replies:
    2
    Views:
    257
    Gilles Ganault
    Apr 8, 2011
  3. heli0s

    Download Files With a perl script

    heli0s, Aug 4, 2005, in forum: Perl Misc
    Replies:
    8
    Views:
    118
  4. Replies:
    13
    Views:
    285
    Tad McClellan
    Feb 17, 2007
  5. Replies:
    5
    Views:
    170
    Joe Smith
    Feb 26, 2007
Loading...

Share This Page