dqnrk44682 2014-08-27 10:04
浏览 65
已采纳

PHP - 上传Outlook电子邮件

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

  • 写回答

1条回答 默认 最新

  • doufen1933 2014-08-27 10:13
    关注

    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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺