PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hey everyone, long time no see! Hope everyone is doing well. I have a quick question for you all. I have a situation in which i can only accept a certain type of file which is easily attained by $_FILES['type']. This, however, imposes a problem. I am only allowed to accept .tif files. what if someone renames their .exe virus with a .tif extension. I tested it and ['type'] is the type of the file that the extension says it is. Meaning, if they change the exe to tif, it will give .tif properties and not the original .exe. My question is, is there a way to detect the type of the file no matter what extension is on the file? Any help is much appreciated.
The only problem is that it will also accept any other image file (jpeg, png, etc). If supporting ONLY tif is a requirement, you need fileinfo/mime magic.
Thank you all very much. getimagesize() returns the correct image type no matter what you change it to. Thanks again guys, hope you all have a very happy holiday!