I read pathinfo basename and the like. But all I collect is how to get the details I want using the absolute / relative path. I am trying to figure out how I can get filename.ext from the url string (optional active url, maybe user url).
I'm currently looking to get the file name and extension of user-provided URLs containing images. But you might want to expand it further down the road. Thus, in everything I would like to find out how I can get the file name and extension
I was thinking of trying to use some preg_match logic to find the last / in the url, split it, find it? from this (if any) and remove the point outside it, and then try to figure it out after what remains. but I get stuck in cases where the file has several . in the name, 2012.01.01-name.jpg .: 2012.01.01-name.jpg
So, I am looking for a reasonable optimal way to do this without significant errors.
chris source share