Link to home
Avatar of hibbidiji
hibbidiji

asked on

parsing filename from a full path+filename

I am grabbing full paths to files from file input boxes on my web page.   I, therefore have path strings like this:

c:\files\music\myfile.mp3

I might also get it in unix like this:

/usr/home/me/music/myfile.mp3

I would like to get a js function that I can pass strings like these and it will determine if it is windows or *nix and will return just the filename itself: 'myfile.mp3'

help!
SOLUTION
Avatar of todd_farmer
todd_farmer
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
ASKER CERTIFIED SOLUTION
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of hibbidiji
hibbidiji

ASKER

Great answers - I just wish the delphi area was as active nowadays