Wrox Programmer Forums
|
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 26th, 2006, 03:59 AM
Friend of Wrox
 
Join Date: May 2005
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hastikeyvan
Default hyperlink problem

Hello all
I'm trying to have a link to a file that is in my F drive and other users on our local network should have access to this file by clicking the link in my webprograms that are located in wwwroot.
would you please tell me how should i give the ahref address to gain this aibility.
Thank you

 
Old January 21st, 2007, 04:15 PM
Friend of Wrox
 
Join Date: May 2005
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hei!

If you still are there, can you show the code (the ancor-tag) if you have tried, but failed?

Mvh
grstad
 
Old January 21st, 2007, 06:21 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

You need to use the FileSystemObject to access the file, the anchor tag is the easy part. Ask Google:

'asp file system object link to file'

Wind is your friend
Matt
 
Old January 22nd, 2007, 05:57 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 479
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to surendran Send a message via Yahoo to surendran
Default

hi hastikeyvan,
you can use map path for read files,
or if u are using local jost you give the local path like <a href="f:\filename.pdf"></a>

surendran
(Anything is Possible)
http://ssuren.spaces.msn.com
 
Old January 22nd, 2007, 10:38 AM
Friend of Wrox
 
Join Date: May 2005
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hastikeyvan
Default

I used local addressing but it cant find the file and it gave me file not found error(It jus looks in wwwroot and can not see other parts of computer).I used server.mappath but it didn't answered.I didn't use fSO.Would you please explain more how can I use it as hyperlink.
Thank you for you replys(I got disappointed to get an answer)


 
Old January 22nd, 2007, 07:03 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

You cant just use sever.mappath you need to use the FSO, then the server.mappath syntax - did you ask google?

Anyhow here is a copy n paste piece of code that:
>will work for you
>give you an idea of how the FSO is used
>shows you an example of the type of anchoer tag you need

Drop this page into any directory within your asp application. It will list the contents and link to each file:

<% OPTION EXPLICIT %>
<%
  Dim strPathInfo, strPhysicalPath,objFSO, objFile, objFileItem, objFolder, objFolderContents
  strPathInfo = Request.ServerVariables("PATH_INFO")
  strPhysicalPath = Server.MapPath(strPathInfo)
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  Set objFile = objFSO.GetFile(strPhysicalPath)
  Set objFolder = objFile.ParentFolder
  Set objFolderContents = objFolder.Files
%>
<HTML>
 <HEAD>
  <TITLE>CDisplay Directory</TITLE>
 </HEAD>
<BODY>
<TABLE cellpadding=5>
 <TR align=center>
  <TD align=left><B>File Name</b></TD>
  <TD><B>File Size</B></TD>
  <TD><B>Last Modified</B></TD>
 </TR>
<%
  For Each objFileItem In objFolderContents
     Response.Write "<TR><TD align=left>" %>
     <a href="<%= objFileItem.Name %>" target="_blank"><%= objFileItem.Name %></a>
<% Response.Write "</TD><TD align=right>"
     Response.Write objFileItem.Size
     Response.Write "</TD><TD align=right>"
     Response.Write objFileItem.DateLastModified
     Response.Write "</TD></TR>"
  Next
%>
</TABLE>
</BODY>
</HTML>

FYI: If you want to get real techo visit:
 http://www.brainjar.com/asp/dirlist/
Wow - this guy has some serious FSO code going on!!!

Wind is your friend
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Hyperlink JaffAJob Word VBA 3 August 28th, 2007 11:50 AM
HyperLink Problem monika.vasvani ASP.NET 1.0 and 1.1 Professional 2 September 30th, 2006 05:17 AM
Hyperlink Problem Lalit Pradhan ASP.NET 2.0 Professional 2 June 14th, 2006 09:36 AM
hyperlink problem Abhinav_jain_mca General .NET 3 August 27th, 2004 07:54 AM
hyperlink problem Abhinav_jain_mca SQL Server 2000 1 August 25th, 2004 01:43 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.