PHP xls, xlsx, ppt, pptx headers

后端 未结 4 1967
不知归路
不知归路 2021-01-31 10:04

Here is my code where I am trying to send a correct header depedning on a type of a document. I figured out the headers for pdf, doc and docx but I still need to know correct he

相关标签:
4条回答
  • 2021-01-31 10:45

    Since most of the types requested are Microsoft Office related, this link has all of the office mime types (the best focused source I've found so far): http://filext.com/faq/office_mime_types.php

    0 讨论(0)
  • 2021-01-31 10:52

    You can simply echo $_FILES['input_tag_name']['type'] after upload a file to know the MIME type of that file.

    0 讨论(0)
  • 2021-01-31 10:53

    .xls

    application/vnd.ms-excel

    .xlsx

    application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

    .ppt

    application/vnd.ms-powerpoint

    .pptx

    application/vnd.openxmlformats-officedocument.presentationml.presentation

    And one of those you have listed is wrong:

    .docx

    application/vnd.openxmlformats-officedocument.wordprocessingml.document

    0 讨论(0)
  • 2021-01-31 11:01

    See http://www.w3schools.com/media/media_mimeref.asp .

    xls is application/vnd.ms-excel, ppt is application/vnd.ms-powerpoint.

    0 讨论(0)
提交回复
热议问题