Solved

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

Posted on 2008-10-26
12
252 Views
Last Modified: 2010-04-16
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
Comment
Question by:bsharath
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 3
12 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22810907
0
 
LVL 11

Author Comment

by:bsharath
ID: 22810919
Thank U any html code please...
0
 
LVL 58

Expert Comment

by:tigermatt
ID: 22811064

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
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

 
LVL 11

Author Comment

by:bsharath
ID: 22811149
Its for the intranet site of our.
For now its on my machine
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22811198
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
 
LVL 58

Accepted Solution

by:
tigermatt earned 500 total points
ID: 22826138

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
 
LVL 11

Author Comment

by:bsharath
ID: 22831166
Thank you Matthew ... How do i execute this. Saveas?
0
 
LVL 58

Expert Comment

by:tigermatt
ID: 22831295

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
 
LVL 11

Author Comment

by:bsharath
ID: 22832626
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
 
LVL 11

Author Comment

by:bsharath
ID: 22832631
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
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22832781
Normally I would save such a script as .hta and not serve it from a web server but directly from a hard disc
0
 
LVL 58

Expert Comment

by:tigermatt
ID: 22832853

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Navigation is an important part of web design from a usability perspective. But it is often a pain when it comes to a developer’s perspective. By navigation, it often means menuing. This is less theory and more practical of how to get a specific gro…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question