I want to get the file extension only of a file.
e.g. "myfile.jpg", I want to put in a variable the string ".jpg".

How?

Member Avatar for diafol

loads of ways.
One easy way:

$extension = pathinfo($file, PATHINFO_EXTENSION);
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.