Re: Arrggg: stripping a file name
| From: | Norbert Mocsnik | Date: | Fri, 03 Dec 2004 23:27:21 +0000 |
| Subject: | Re: Arrggg: stripping a file name | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-16000@lists.php.net to get a copy of this message | ||
This is not a PEAR related question.
function after_last ($this, $inthat)
{
if (!is_bool(strrevpos($inthat, $this)))
return substr($inthat, strrevpos($inthat, $this)+strlen($this));
};
echo after_last('\\', 'c:\myfiles\pictures\abc.jpg');
taken from the manual
http://php.net/substr
note:
When working with single quotes (') and your string ends with
a backslash \, you should double it.
e.g.
'c:\myfiles\pictures\abc.jpg'
'c:\myfiles\pictures\\'
'c:\myfiles\pictures'
'c:\myfiles\\'
Please ask PEAR-related questions here.
--
Regards,
Norbert Mocsnik
http://norbert.mocsnik.hu/
Jeff Jordan wrote:
> I would appreciate any help someone can give.
>
> I have a field that contains c:\myfiles\pictures\abc.jpg
>
> all I want to store in my table is abc.jpg
>
> The last effort was
>
> $myfile = explode('\x92', $_POST[frontelevsrc]);
> $_POST[frontelevsrc] = array_pop($myfile);
>
> note: I have also tried "\x92" (double quotes).
>
> Can anyone help?
>
> Thanks
> Jeff
>