That's not too difficult. First, you want to chop anything off after the last \ You can use the command strrpos() to find the position, and then substr to chop it off. However, / is the escape chatacter, so you need to escape that one (/). Finally you need to add +1 the the position since you don't want to include the \ in the result, so:
CODE
$string = substr($string,strrpos($string,'/')+1);
Then, if you want to get the file extension, do the same thing for the . Because there can be more . in a file name you also search for the latest occurence.
CODE
$string = substr($string,0,strrpos($string,'.'));
And there you have it..
Another posts included in "PHP"
| How to download a file from a certain URL to server ? (0) | 2008/01/21 |
| ISO 8601 format time format string conversion (0) | 2008/02/13 |
| Get the actual filesize for a size above 2GB in Windows (0) | 2008/02/24 |
| File downloading via HTTP (0) | 2008/01/21 |
| How to block a connection from the certain site ? (0) | 2008/01/14 |
| XMLRPC example (0) | 2008/01/07 |
| How to upload attachments such as image by metaWeblog API ? (0) | 2008/01/07 |
| How to post blog content by metaweblog API ? (3) | 2008/01/02 |
Trackback : Cannot send a trackbact to this post.
-
Subject Ambien cr 12.5 photo.
2008/12/17 16:53
Ambien sleeping pill. Ambien. Ambien next day delivery. What color is ambien.
-
Subject Furniture shopping in high point nc.
2008/12/29 03:02
Patrician furniture high point nc.
-
Subject Free pics zoo porn.
2009/03/30 17:26
Animal sex zoo free porn. Free zoo porn movies. Free zoo porn.
-
Subject Cialis.
2009/05/25 15:04
Cialis. Liquid cialis.
-
Subject different money making ideas
2010/01/25 08:42
moneyideas
-
Subject different money making ideas
2010/01/28 22:03
moneyideas
-
Subject different money making ideas
2010/01/29 06:21
moneyideas
-
Subject different money making ideas
2010/01/31 16:43
moneyideas

Prev

Rss Feed