How to

How to get a file extension with PHP

The following script makes it more easy to get the file extension from a file name:

In case you have the ability to use mime type detection, you could combine it with the above function to validate if the extension is valid for the content of the file.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.