Prevent upload shell files. php -
i have image upload website. uploading here shells files. validations are: - check file's mime (only image's mimes able) - check if getimagesize returning array (by is_array) if not, error. , still, uploading shells files. please help. thnkas alot!
little check:
$ext = ($_files['files']['type']); if (($ext != "image/jpeg") && ($ext != "image/pjpeg") && ($ext !="image/png") && ($ext != "image/gif") && ($ext != "image/bmp") && ($ext != "image/x-icon") && (!is_array(getimagesize($_files['files']['tmp_name'])))) { // show error } else { // keep upload... }
you should check files permissions, should not executed php. it's easy store data in raster data matrix of image (obviously).
look @ these innocent jellyfishes :
stackoverflow converted innocent .bmp in .png
the original .bmp can found on a friend's server. if in bottom-left corner, see strange pixels, corresponding ascii data written in pixel data.
in order avoid shell files, should apply modification alterate little bit every pixel of images.
to me, convertion (compression) seems start.
good luck !
Comments
Post a Comment