Hello,... i have some problem with image filter in my form processor. 1. As we know in string we have htmlspecialchars to counter unexpected script. how about file field, how to filter it. it seem impossible to use htmlspecialchars there, because sometimes a path fro a file use special character. 2. how can i now the image extention, let say that i only receive file with jpg extention, & reject the other one. 3. how can i now what is the image dimension (W & L), so i can reject an image with width size more than xxx pixel. I apriciate very much for your help Best Regards......
For 2,3 There are array getimagesize ( string filename [, array &imageinfo] ) fuction. imageinfo parameter: this optional parameter allows you to extract some extended information from the image file. Returns an array with 5 elements. Index 0 and 1 contains respectively the width and the height of the image. Index 2 is one of the IMAGETYPE_XXX constants indicating the type of the image (for JPG it is IMAGETYPE_JPEG).
Image types: IMAGETYPE_GIF image/gif IMAGETYPE_JPEG image/jpeg IMAGETYPE_PNG image/png IMAGETYPE_SWF application/x-shockwave-flash IMAGETYPE_PSD image/psd IMAGETYPE_BMP image/bmp IMAGETYPE_TIFF_II (intel byte order) image/tiff IMAGETYPE_TIFF_MM (motorola byte order) image/tiff IMAGETYPE_JPC application/octet-stream IMAGETYPE_JP2 image/jp2 IMAGETYPE_JPX application/octet-stream IMAGETYPE_JB2 application/octet-stream IMAGETYPE_SWC application/x-shockwave-flash IMAGETYPE_IFF image/iff IMAGETYPE_WBMP image/vnd.wap.wbmp IMAGETYPE_XBM image/xbm