class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
However if I try to do it for a MS Publisher file (.pub) then it fails to identify the mime type: Log output: system information - class version : 0.26 - GD version : 2.0.28 - supported image types : png jpg gif bmp - open_basedir : /home/****/:/tmp:/usr/local/lib/php/ - language : en_GB source is a local file /home/****/class_fans_9.pub - local file name OK - MIME type detected as by UNIX file() command - MIME type detected as by browser - Try to guess MIME type from file extension (pub): MIME type set to - MIME type couldn't be detected! - source variables file_src_name : class_fans_9.pub file_src_name_body : class_fans_9 file_src_name_ext : pub file_src_pathname : /home/****/class_fans_9.pub file_src_mime : file_src_size : 75776 (max= 2097152) file_src_error : 0
Is there any way to add/check mime types manually, as i guess you can't possibly cater for all the hundreds of other file types out there which aren't in the functions which are checking...
Thanks.
BTW I found I had to add the following to make downloads work in IE6:
header('Cache-Control: maxage=10');
header('Pragma: public');
header("Expires: ".gmdate("D, d M Y H:i:s", mktime(date("H"), date("i"), date("s")+10, date("m"), date("d"), date("Y")))." GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Content-Length: ".$handle->file_src_size);
When I force the download of a file using your suggested code (from http://www.verot.net/res/sources/class.upload.html) it usually works fine:
However if I try to do it for a MS Publisher file (.pub) then it fails to identify the mime type:
Log output:
system information
- class version : 0.26
- GD version : 2.0.28
- supported image types : png jpg gif bmp
- open_basedir : /home/****/:/tmp:/usr/local/lib/php/
- language : en_GB
source is a local file /home/****/class_fans_9.pub
- local file name OK
- MIME type detected as by UNIX file() command
- MIME type detected as by browser
- Try to guess MIME type from file extension (pub): MIME type set to
- MIME type couldn't be detected!
- source variables
file_src_name : class_fans_9.pub
file_src_name_body : class_fans_9
file_src_name_ext : pub
file_src_pathname : /home/****/class_fans_9.pub
file_src_mime :
file_src_size : 75776 (max= 2097152)
file_src_error : 0
Is there any way to add/check mime types manually, as i guess you can't possibly cater for all the hundreds of other file types out there which aren't in the functions which are checking...
Thanks.
BTW I found I had to add the following to make downloads work in IE6: