bass71982
bass71982

Reputation: 75

PHP - Upload outlook email messages

I am trying to allow users to upload outlook email messages saved as .msg files but my error system says the messages are not part of my allowed bunch. I have tried 3 different outlook types but to no avail. What is the correct mime type?

Here is my shortened code.

$whitelist = array('application/outlook','application/msoutlook','application/vnd.ms-outlook');
$errors = false;

if (isset($_POST['submit'])) {

$uniqueid = time().$_SESSION['webuserid'];
$description = htmlspecialchars($_POST['description']);

if (empty($_FILES['file']['name'])) { 

$message = "<b> * No File Selected</b>"; $errors = true; }

if ($_FILES['file']['size'] > 5000000 && !empty($_FILES['file']['name'])) { 

$message = "<b> * 5MB Max Upload</b>"; $errors = true; } 

if (!in_array($_FILES['file']['type'], $whitelist) && !empty($_FILES['file']['name'])) { 

$message = "<b> * PDF, Excel, Outlook Message, Word Format Only</b>"; $errors = true; }

Thanks

Upvotes: 0

Views: 1854

Answers (1)

TunaMaxx
TunaMaxx

Reputation: 1769

So why don't you var_dump($_FILES['file']['type']); for a .msg file and see what it says? Then add that to your $whitelist.

You'll probably find the mimetype is application/vnd.msoutlook

Upvotes: 1

Related Questions