I'm using PHP to send an email with an attachment. The attachment could be any of several different file types (pdf, txt, doc, swf, etc).
First, the script gets the file using "file_get_contents".
Later, the script echoes in the header:
Content-Type: <?php echo $the_content_type; ?>; name="<?php echo $the_file_name; ?>"
How to I set the correct value for $the_content_type?
try this:
I've tried most of the suggestions, but they all fail for me (I'm inbetween any usefull version of PHP apparantly. I ended up with the following function:
I guess that i found a short way. Get the image size using:
$infFil=getimagesize($the_file_name);
and
The
getimagesize
returns an associative array which have a MIME keyI used it and it works
This worked for me
Why is mime_content_type() deprecated in PHP?