urgent... how to get filename from "a:\b\c.txt"

R

ray

i have a <input type=file> and trying to get the filename from user input.

i tried the following but doesn't seem to work.

function getFilename(s){
var fn = new String();
fn = s;
return fn.substr(fn.lastIndexOf("\\"), fn.length());
}

i think the single "\" from the file input box screw me up.

ray
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,077
Messages
2,570,567
Members
47,202
Latest member
misc.

Latest Threads

Top