PHP upload pictures to determine the type

PHP judge upload pictures types
with getimagesize to judge upload pictures type is more reliable than type $ _FILES function of
the same file, type type use a different browser php return is not the same, providing type type by the browser, then
it there could be exploited by hackers to submit a picture suffix support disguise executable files to the server.
<pre>

If by the getimagesize () function returns such an array wherein the index is a Type 2
1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF (intel byte
Order), TIFF. 8 = (byte Motorola Order), JPC =. 9, 10 = = JP2,11 JPX, 12 is =
JB2,13 = the SWC, IFF = 14, 15 = WBMP, XBM = 16
<pre>
the Array
(
[0 ] => 331
[. 1] => 234
[2] =>. 3
[. 3] => width = "331" height = "234"
[bits] =>. 8
[MIME] => Image / PNG
)
</ pre>

 

Guess you like

Origin www.cnblogs.com/newmiracle/p/11865497.html