Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   Generic way to extract filename from path independent on platform (http://www.velocityreviews.com/forums/t797879-generic-way-to-extract-filename-from-path-independent-on-platform.html)

PeterB 02-09-2005 07:53 AM

Generic way to extract filename from path independent on platform
 
Hello!

I'm using the following method to retrieve the filname from a full server
path:

<%
sub getfname(strPath)
Dim fName
fName = Mid(strPath,InStrRev(strPath,"\")+1)
'fName = strPath
Response.Write( fName )
end sub
%>

However this only works on Windows systems as it checks for backslash. Is
there a more generic way to do this, or should I check for both backslash
and slash in the path?

thanks,

Peter



PeterB 02-10-2005 08:12 AM

Re: Generic way to extract filename from path independent on platform
 
A / perhaps? Unix notatio, there are Unix/Linux modules for .NET out there
so it would be possible to run an ASP site on a linux-machine...

/ Peter


"Curt_C [MVP]" <software_AT_darkfalz.com> skrev i meddelandet
news:uWPOHhtDFHA.2540@TK2MSFTNGP09.phx.gbl...
> huh? What else would it be if not a \
>
>
> --
> Curt Christianson
> Site & Scripts: http://www.Darkfalz.com
> Blog: http://blog.Darkfalz.com
>
>
> "PeterB" <peter@data.se> wrote in message
> news:%23vn7ixnDFHA.1668@TK2MSFTNGP10.phx.gbl...
>> Hello!
>>
>> I'm using the following method to retrieve the filname from a full server
>> path:
>>
>> <%
>> sub getfname(strPath)
>> Dim fName
>> fName = Mid(strPath,InStrRev(strPath,"\")+1)
>> 'fName = strPath
>> Response.Write( fName )
>> end sub
>> %>
>>
>> However this only works on Windows systems as it checks for backslash. Is
>> there a more generic way to do this, or should I check for both backslash
>> and slash in the path?
>>
>> thanks,
>>
>> Peter
>>

>
>





All times are GMT. The time now is 10:29 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.