path = file; parts = path.split("/"); filename = parts[parts.length - 1]; alert(filename);