My uploader allows the following file formats:

jpg
pdf
gif
png

I tested that if someone was to name a file configure.php.jpg, my uploader allows it to upload

I want to do a check to see if the user has 2 extensions, and if so it will not allow them to upload.

I was thinking of just checking if the file name has two "." (dots) in the name. What function could I use to do this?

Or .. is there a better way?

You could use substr_count() to check for the dots, but you should also check the mime type to make sure it's an image.

u could use strrpos function to identify the positions of the dots.
but, i dont think a file would have two extensions. extension is the one that comes after the last dot no matter how many dots a file name has.
if you already do not know about it, you might find the global array $_FILES helpful. $_FILES["file"]["type"] would give you the type of the file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.