Mime type for zip file in Google Chrome

前端 未结 3 701
刺人心
刺人心 2020-12-18 20:02

I discovered a weird issue in zip file\'s mime type when I worked on a Symfony application.

According to w3school, the mime type for zip file is application/z

相关标签:
3条回答
  • 2020-12-18 20:47

    As of now, MIME type of a zip file is application/octet-stream in Google Chrome. :)

    0 讨论(0)
  • 2020-12-18 20:49

    Seems to me like there is a bug in Symfony.

    A ticket has been opened at here.

    0 讨论(0)
  • 2020-12-18 20:53

    This is Google Chrome's bug not Symfony. I have the same problem with Google Chrome's ZIP mime.

    I have my own application written in php.

    When you write echo $_FILES['yournameattr']['type']; it returns empty string when you upload a zip file but when you upload a gif or jpeg file it returns image/jpeg or image/gif.

    I have Google Chrome version 3.0.195.6 (beta).

    Though if you need fast solution, you can use preg_match to check the file's extension (zip or not).

    if (preg_match('/(.*)\.zip/',$_FILES['yournameattr']['name'])) {echo 'This is zip.';}
    
    0 讨论(0)
提交回复
热议问题