Re: how to trim file path from filename



Bart Van der Donck wrote on 31 mrt 2008 in comp.lang.javascript:

Tom Cole wrote:

I would still recommend using server side code rather than javascript
on the client for making this split. The package reference by Erwin
Moller above would be how I would probably proceed with something like
this.

Me too. And it is a somewhat uncommon task for (client-side)
javascript. Normally a server program would parse this kind of data.

Indeed, but that can be done using serverside javascript
as requested and on topic:

<% // javascript

var url = 'http://aa.xx/bb/cc/dd.html';

var temp = url.split('/');
var file = temp.pop();
temp.push('');
var path = temp.join('/');

%>


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
.



Relevant Pages