Forums

ASP

This topic is locked

truncating the path of a file...

Posted 11 May 2001 00:38:49
1
has voted
11 May 2001 00:38:49 Larry Ostrovsky posted:
I need some help in truncating a path and leaving only the filename.

For example:
I grab c:\directory\filename.txt in a form using <input type="file" name="name" size="20" value="">
I need just the 'filename.txt' to cary over into the database.

Any suggestions?



Replies

Replied 30 May 2001 19:05:17
30 May 2001 19:05:17 Joel Martinez replied:
function filename(name) 'as String
tmpStr = split(name, "\"
max = Ubound(tmpStr, 1)

filename = tmpStr(max)
end function

I believe that'll work... if you get a subscript error... try messing with the "max" variable (adding or subtracting one)

I didn't get a chance to test this so hope it helps,
Joel Martinez

...is this thing on?

Reply to this topic