Jump to content

Urgent - Retrieving the file extension from a string.


webmasteroy

Recommended Posts

Hey, I am have huge problems with this simple problem. I am trying to retrieve the file extension of a file from a string like I have string say "file.php" how do I get the .php out of that with out just saying it is .php like:

 

Say I have a bunch of files that I might be using in actuallity it is infinite.

 

So lets say the files it could be for now are:

 

file.php

file.htm

file.html

file.gif

file.jpg

file.css

file.js

 

If I don't know what the file extension is and I can't think of possible extensions. What would I do to retrieve the file extension on those.

 

I'm thinking of maybe some function that takes the string and cuts off the first section of the string before the dot. Rather then cutting of the extension like strtok($value, ".");.

 

Also you should note my host does not have finfo functions or there is one other function for gathering the mimetypes forgot what it was and can't find it now though.

 

Thanks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.