> -----Original Message-----
> From: Micah Montoy [mailto:montmicaisu.edu]
> Sent: 09 July 2003 01:37
>
> A couple more things and I'll stop bugging everyone. I'm
> trying to get the
> file name of the string. If it includes the extension that's
> fine as well.
> I thought the code below would do this but its not.
>
> $filevalue = str_replace("\\\\", "/", $filevalue);
>
> //get specific file name
> $parts = explode("/",$filevalue);
> $file_name = $parts[count($parts)]; //line 42
>
> Its giving me error:
> Notice: Undefined offset: 6 in
> c:\inetpub\wwwroot\webpage10\example\u_images\act_ load_imgs.ph
> p on line 42
This is because count() returns the number of elements in the array, but because the indexes start at zero the highest offset is count($parts)-1 -- so when you try to access element count($parts), PHP throws a wobbly.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: [email]m.fordlmu.ac.uk[/email]
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211