Jump to content

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!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.