Reply to Re: MIME type couldn't be detected

Re: MIME type couldn't be detected new!
by Chaman, 15 years, 3 months ago
I have tried adding this mime type, but it doesn't seem to work.

I also found application/x-mspublisher from http://filext.com/file-extension/PUB

This is my code (iin case i#I've added the code in the wrong place):

$handle = new upload(PATH_TO_ROOT.$row['dfilename']); 
			
// attempted fixes for dodgy MS Publisher mime type
$handle->allowed = array('\012- application/msword');
$handle->allowed = array('application/x-mspublisher');
$handle->allowed = array('012- application/msword');
			
// extras
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);
			
header('Content-type: ' . $handle->file_src_mime);
header("Content-Disposition: attachment; filename=".rawurlencode($handle->file_src_name).";");
header("Content-Transfer-Encoding: binary\n");
			
// capture log ready to email 		
$_SESSION['error'] = $handle->log;
			
$to      = 'EMAIL_TO_ADMIN';
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";// To send HTML mail, the Content-type header must be set
$headers .= 'From: '.EMAIL_FROM_WEBSITE;
$subject = WEBSITE_NAME . ' fetch data';
$message = ''.$_SESSION['error'].'';
$ok = @mail($to, $subject, $message, $headers);

echo $handle->Process();
die();

If the detection continues to fail (or indeed another bad type fails detection) I guess I could just see if file_src_mime = '' and then just provide a direct link to the file instead?Reply

Your reply

Name *
Email 
Title *
Text *
CAPTCHA image
Enter the code displayed on the image:
Click on the image to generate another one if it is hard to read it. The case is important