Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 255
  • Last Modified:

Create a Html page that searches the filenames and displays the page.

Hi,

Create a Html page that searches the filenames and displays the page.
I want a page when entered a id it searched that id in the mentioned UNC or drive and opens the html page.

Like
1234
and it searched the filename and opens that page.

Regards
Sharath
0
bsharath
Asked:
bsharath
  • 5
  • 4
  • 3
1 Solution
 
Michel PlungjanIT ExpertCommented:
0
 
bsharathAuthor Commented:
Thank U any html code please...
0
 
tigermattCommented:

Sharath,

Will this be running locally just on your PC, or published to the web and to run on a server? The only reason I ask is if you will not be running it locally and will be uploaded it to a web server, you will need some server-side code (ASP, PHP etc.) to achieve this.

Matthew
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
bsharathAuthor Commented:
Its for the intranet site of our.
For now its on my machine
0
 
Michel PlungjanIT ExpertCommented:
Change
Msgbox Join(Location,vbCr)

to loop over Location's

Something like

Dim text
For Each item In Location
    text = text &  "<br /><a href='" & item & "'>" & item &"</a>"
Next
document.getElementById('output').innerHTML=text

and have a div id="output" somewhere
0
 
tigermattCommented:

Sharath,

This is ASP code which you can put in an ASP file and save to your Intranet. If no path is provided then it will show a form for you to input the first part of the file name, and then it will take you to a list of all the files which match in the specified directory. You'll need to provide the name of the directory on line 4.

Matthew
<%@ Language="VBScript" %>
<%
Dim fso: Set fso = Server.CreateObject("ADODB.Recordset")
Dim objFolder: Set objFolder = fso.GetFolder("C:\documents") 'Path to documents folder
Dim strURL: strURL = CStr(Request.QueryString("path"))
 
If strURL = "" Then
	Response.Write "<form action='" & Request.ServerVariables("URL") & "' method='get'>" & _
		"Search for Files beginning with the text: <input type='text' name='path' value='' />" & _
		"<input type='submit' value='GO >>>' /></form>"
	Response.End
Else
	
	Dim filematches()
	intArrMax = 0
	
	for each objFile in objFolder.Files
		If (Left(LCase(objFile.Name),Len(strURL)) = LCase(strURL)) Then
			redim preserve filematches(intArrMax)
			filematches(intArrMax) = objFile.Name
			intArrMax = intArrMax + 1
		End if
	next
	
	' Show all the matches
	Response.Write "Matches found:<br />"
	For i = 0 To UBound(filematches) Step 1
		
		Response.Write "<a href='" & objFolder.Path & "\" & filematches(i) & "'>" & filematches(i) & "</a>"
		
	Next
	
End If
%>

Open in new window

0
 
bsharathAuthor Commented:
Thank you Matthew ... How do i execute this. Saveas?
0
 
tigermattCommented:

Put it into a Notepad page, then go to File, Save As. You have to type the filename as "filename.asp", with the quote marks and .asp on the end.

You will also need to execute the script on an IIS Server. This means it has to go into C:\Inetpub\wwwroot (once IIS is installed), and then you would go to http://<your computer's IP address>/filename.asp to access it.

Matthew.
0
 
bsharathAuthor Commented:
Matthew i get this
HTTP Error 404.3 - Not Found
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

When i tried to browse to the asp.
0
 
bsharathAuthor Commented:
When i try to open the asp or like this
C:\inetpub\wwwroot\Search.asp
It asks me to save or open when i select open it again asks me to save...
0
 
Michel PlungjanIT ExpertCommented:
Normally I would save such a script as .hta and not serve it from a web server but directly from a hard disc
0
 
tigermattCommented:

The only reason I suggest this be saved as an ASP page is because as mentioned it will be part of a company intranet.

With regards to the IIS problem, you definitely need to browse to the file using http://computername/search.asp (or you could use http://127.0.0.1/search.asp from your own PC). When you installed IIS on your Vista machine in Add/Remove Windows Features, did you check the box 'ASP' under 'World Wide Web Services'?
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now