|登录 |注册

查看: 1550|回复: 4
打印 上一主题 下一主题

mime type 辨别~求助 [以解决]

[复制链接]
缘之人
2012-3-1 05:17 PM
本帖最后由 缘之人 于 2012-3-1 08:39 PM 编辑

if($_FILES['userfile']['type'] !='image/vnd.adobe.photoshop' && 'application/postscript') {
    echo "sorry,we only allow PSD / AI FILES";
        exit;
        }


各位大大们~要怎样才能一次过辨认PSD 和 AI file 这2种mime type 呢?
weeming21
2012-3-1 05:22 PM
if($_FILES['userfile']['type'] !='image/vnd.adobe.photoshop' || $_FILES['userfile']['type'] !='application/postscript') {

大概是这样

你只是验证这个userfile type? 没有做其他验证?
如果但只是这样的验证,分分钟你系统会被上传后门被入侵
缘之人
2012-3-1 05:41 PM
回复 2# weeming21


    谢谢大大~~PSD和AI file 的mime type 是那个吗? 我试了好多次都不行   

  我只做了这个 + php,asp 的 preg_match
Super-Tomato
2012-3-1 07:57 PM
本帖最后由 Super-Tomato 于 2012-3-1 08:12 PM 编辑
if($_FILES['userfile']['type'] !='image/vnd.adobe.photoshop' && 'application/postscript') {
    ech ...
缘之人 发表于 2012-3-1 05:17 PM



mime 類型你已經知道了,那麽就用 php 所提供的 mime_content_type 函數(pear)來做比對


p/s: 剛查了一下 psd 和 ai 的 content-type 是這個
psd = application/octet-stream
ai = application/postscript
缘之人
2012-3-1 08:39 PM
回复 4# Super-Tomato


    谢谢大大,成功了
您需要登录后才可以回帖 登录 | 注册

JBTALKS.CC |联系我们 |隐私政策 |Share

GMT+8, 2025-12-31 09:08 PM , Processed in 0.091581 second(s), 25 queries .

Powered by Discuz! X2.5 © 2001-2012 Comsenz Inc.

本论坛言论纯属发表者个人意见,与本论坛立场无关
Copyright © 2003-2012 JBTALKS.CC All Rights Reserved

Dedicated Server powered by iCore Technology Sdn. Bhd.

合作联盟网站:
JBTALKS 马来西亚中文论坛 | JBTALKS我的空间 | ICORE TECHNOLOGY SDN. BHD.
回顶部