Saturday, July 17, 2010

force download php function

hi friends i found a nice downlaod script i love to use this to amke browser force to download the image file word file xls file and so on..
Chk this function here
$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’
);
see the array used in this function you can modify this array to add and delete the type of file you want ot allow to downlaod.
you can download php function from here
Get more info:http://oneanall.com/php/2010/07/17/downloading-function-php/