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.
Asked
Active
Viewed 48 times
-1
-
1didn't find anything in Google? am sure there are a lot of Q&A's for this – Funk Forty Niner Oct 08 '15 at 13:29
-
Fred, can you please answer me with efficient code. or just give me the link of the question which is already answered. – Nahid Hossain Shihab Oct 08 '15 at 13:46
-
what're you telling me for? you should be pointing that to the guy who gave you an answer man. See the link the question's been closed with. – Funk Forty Niner Oct 08 '15 at 13:48
1 Answers
0
You can use getimagesize(), it will return 0 if it is not an image.

chandresh_cool
- 11,753
- 3
- 30
- 45
-
-
-
*hic!* - oops, pardon me. I'm flying, I mean I'm fine, e tu? @MajidLaissi – Funk Forty Niner Oct 08 '15 at 13:53
-
-
@MajidLaissi Time for you to go to the "Foo baz" **bar** then ;-) or "salad" bar. – Funk Forty Niner Oct 08 '15 at 13:56
-