Download files script.

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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: 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. "/" )

// log downloads?  true/false

// log file name

// 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
// installed on server.
$allowed_ext = array (

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

  // documents
  'pdf' => 'application/pdf',
  'doc' => 'application/msword',
  'xls' => 'application/',
  'ppt' => 'application/',

  // 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.

Re: Download files script.

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

Quoted text here. Click to load it

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


Re: Download files script.

Quoted text here. Click to load it

How do i do that?

Re: Download files script.

mathaios wrote:
Quoted text here. Click to load it

That is a question for an HTML newsgroup.

Seriously, if you don't know how to create a link to a file, you don't
have any hope of installing a script.

Site Timeline