-1

How to detect an image file's original extention.Suppose the user uploaded a file with extention 'jpg' and that is a successful operation;because jpg is a supported format. Now if the user write a php file with hacking codes and rename the file as extention 'jpg'. Now how to prevent the user from making me fool.

1 Answers1

0

You can use getimagesize(), it will return 0 if it is not an image.

chandresh_cool
  • 11,753
  • 3
  • 30
  • 45