hi,

im, currently working on a mutilmedia hosting script and we only allow certain file types jpg,gif,png for example what i want to know is should i rely on $_FILES['file']['type'] to determine the filetype or should i go with strripos() and rely on the file extension?

i was concerned about going the file extension way simply because it doesnt take much to change a file extension.

any feedback on this would be appreciated.

thanks

    from the manual: (http://www.php.net/manual/en/features.file-upload.php)

    $_FILES['userfile']['type']
    The mime type of the file, if the browser provided this information. An example would be "image/gif". This mime type is however not checked on the PHP side and therefore don't take its value for granted.

    use can use [man]pathinfo[/man] to get the file extension (if there is one).

      Thank, i've opted for relying on both MIMe type and extensions.

        Write a Reply...