473,473 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Read a directory and next making an action.

Sorry for my question, but I'm really a newbie on ASP.

I need to make a simple page (for IIS 5.0 and up, but even for 2000
Professional IIS) that read and display the files contained in a
specified directory and next, clicking on one of them, calling and
making an action with an another ASP page. For example:

http://server/list.asp

Listing Y:\REPOSITORY

ONE.TXT
TWO.TXT
If I clic on ONE.TXT I need to call

http://server/action.asp?go=Y:\REPOSITORY\ONE.TXT

Thank you in advance, and sorry for the dumb question.

Jul 22 '05 #1
8 1838
"McGrull" wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
: Sorry for my question, but I'm really a newbie on ASP.
:
: I need to make a simple page (for IIS 5.0 and up, but even for 2000
: Professional IIS) that read and display the files contained in a
: specified directory and next, clicking on one of them, calling and
: making an action with an another ASP page. For example:
:
: http://server/list.asp
:
: Listing Y:\REPOSITORY
:
: ONE.TXT
: TWO.TXT
:
:
: If I clic on ONE.TXT I need to call
:
: http://server/action.asp?go=Y:\REPOSITORY\ONE.TXT

It's not a dumb question but why would you want to pass the physical path to
the file?

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #2
"Roland Hall" wrote in message news:O0**************@TK2MSFTNGP10.phx.gbl...
: "McGrull" wrote in message
: news:11*********************@z14g2000cwz.googlegro ups.com...
:: Sorry for my question, but I'm really a newbie on ASP.
::
:: I need to make a simple page (for IIS 5.0 and up, but even for 2000
:: Professional IIS) that read and display the files contained in a
:: specified directory and next, clicking on one of them, calling and
:: making an action with an another ASP page. For example:
::
:: http://server/list.asp
::
:: Listing Y:\REPOSITORY
::
:: ONE.TXT
:: TWO.TXT
::
::
:: If I clic on ONE.TXT I need to call
::
:: http://server/action.asp?go=Y:\REPOSITORY\ONE.TXT
:
: It's not a dumb question but why would you want to pass the physical path
to
: the file?

Here is a way to do it without passing the file path/name on the URL.
http://kiddanger.com/lab/geturl6.asp

There's a link on the page to view the source.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #3
Thanks for your reply.

The application, that is third part, need the real path of the file
with the file for call argument . I try to call only the file, but
doesn't do the correct stuff.

Jul 22 '05 #4
Thank you for all. Google and a bit of luck, help me..

I discovered that do the stuff i need. I post it for anyone need the
same..

<html>
<head>
<title></title>
</head><body>
<%
dirtowalk="/dirtoview/"
Set fs = Server.CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(server.mappath(dirtowalk))
Set fc = f.Files
For Each whatever in fc
response.write "<A HREF=http://server/make.asp?function="
response.write whatever.name
response.write ">"
response.write whatever.name
response.write "</A><br>"
Next
%>
</body>
</html>

Jul 22 '05 #5
"McGrull" wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...

: The application, that is third part, need the real path of the file
: with the file for call argument . I try to call only the file, but
: doesn't do the correct stuff.

you already know your virtual path so...

dim virPath, strPath
virPath = "/myfiles"
strPath = Server.MapPath("/myfiles")
Just prepend it: strPath & "/" & filename.ext
--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #6
"McGrull" wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
: Thank you for all. Google and a bit of luck, help me..
:
: I discovered that do the stuff i need. I post it for anyone need the
: same..
:
: <html>
: <head>
: <title></title>
: </head><body>
: <%
: dirtowalk="/dirtoview/"
: Set fs = Server.CreateObject("Scripting.FileSystemObject")
: Set f = fs.GetFolder(server.mappath(dirtowalk))
: Set fc = f.Files
: For Each whatever in fc
: response.write "<A HREF=http://server/make.asp?function="
: response.write whatever.name
: response.write ">"
: response.write whatever.name
: response.write "</A><br>"
: Next
: %>
: </body>
: </html>

My app is distinctly different as my URL never changes and nobody can use
the URL to pass a filename.
Glad you found something you can use.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #7
Ok, and if are more files, and i want to array the listing in multiple
pages, linkable to view the page in my interest, how i can do that?

Jul 22 '05 #8
"McGrull" wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
: Ok, and if are more files, and i want to array the listing in multiple
: pages, linkable to view the page in my interest, how i can do that?

If you're wanting to use the array on multiple pages then you could put your
array in a session variable but copy it to a local variable when you use it.

' get files, put into array
session("arrFiles") = arrFiles

' grab array from session when you want to use it.
dim arrFiles
arrFiles = session("arrFiles")

If you had your files in an array and you had 30 and wanted 10 on each page,
this is one way:

pages: list1, list2, list3

dim i, j, arrList1(), arrList2(), arrList3()
redim arrList1(9) : redim arrList2(9) : redim arrList3(9)
j = 0
for i = 0 to ubound(arrFiles) step 3
arrList1(j) = arrFiles(i)
arrList2(j) = arrFiles(i + 1)
arrList3(j) = arrFiles(i + 2)
j = j + 1
next
erase arrList
if session("assList1") <> "" then
session("arrList1") = arrList1
end if
session("arrList2") = arrList2
session("arrList3") = arrList3

....then on each page:

list1.asp
dim arrList, i
arrList = session("arrList1")
for i = 0 to ubound(arrList)
Response.Write "<a href=""" & arrList & """>" & arrList & "</a><br />"
next

list2.asp
....
list3.asp
....

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: jajoo | last post by:
Hi everyone, I am trying to send files with multipart/form-date. Everything is ok with the send. But when I am receiving the files I should specify a directory where the files to be saved. The...
21
by: AnnMarie | last post by:
<script language="JavaScript" type="text/javascript"> <!-- function validate(theForm) { var validity = true; // assume valid if(frmComments.name.value=='' && validity == true) { alert('Your...
14
by: spike | last post by:
Im trying to write a program that should read through a binary file searching for the character sequence "\name\" Then it should read the characters following the "\name\" sequence until a NULL...
2
by: Profetas | last post by:
I have the following code that detects a <c> and </c> #include <stdio.h> main(int argc, char *argv) { FILE* fp; char data;
2
by: Michael A. Covington | last post by:
I want to deploy a project in which the user is provided with a set of READ-ONLY files to use as templates. They will be in a directory to which the user can add files of his own. It's...
4
by: sturnfie | last post by:
Hey all, I recently came across the xml.sax libraries and am trying to use them. I am currently making a string variable, and am attempting to pass it into a parser instance as follows: def...
8
by: Mr. SweatyFinger | last post by:
where have they all gone. alt.suicide? alt.findContol.then.slit.your.own.throat?
0
by: bcanter | last post by:
I found a file on the web that will allow you to enumerate groups but it was an .hta and the top level admins won't allow this. I need to give managers access to the groups so that when a new user is...
0
by: libish | last post by:
hi all, can any one help me in converting a directory to read only format. and also making a read only directory/file to read/write directory this is to avoid deleting a directory accidently.. ...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.