|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
This fyp folder should be put in C:\Inetpub\wwwroot\
Keep this window open. With the text file ap.txt at desktop Click on it and press Control + C C:\Inetpub\wwwroot\fyp\program.asp performs the 4 task 1. Extracts the text file contents from C:\Inetpub\wwwroot\ap.text 2. Insert into the table “tracking_info” of the database located at C:\Inetpub\wwwroot\database.mdb 3. Delete the text file located at C:\Inetpub\wwwroot\ap.text 4. The program. asp will auto refreshes in 10 seconds waiting for a new ap.txt to generate, have to physically press Control + V per 10 seconds in C:\Inetpub\wwwroot\fyp so that it can pick up the text file in order for program.asp to work. Direct the internet explorer to http://localhost/fyp/program.asp program.asp is as shown.. <HTML> <HEAD> <TITLE>Upload Text in progress</TITLE> <SCRIPT TYPE=text/javascript> // The time out value is set to be 10,000 milli-seconds (or 10 seconds) setTimeout(' document.location=document.location' ,10000); </SCRIPT> <SCRIPT LANGUAGE="vbscript"> 'set focus Sub doFocus opener.focus self.focus End Sub </SCRIPT> </HEAD> <BODY onFocus="doFocus()" onLoad="self.focus()"> <% dim objConn, bjFSO, objTextFile, strNextLine, fs, tfile, fso Set objConn = Server.CreateObject("ADODB.Connection") objConn.Provider = "Microsoft.Jet.OLEDB.4.0" objConn.Open(Server.MapPath("database.mdb")) set objFSO = createobject("scripting.filesystemobject") set objTextFile = objFSO.OpenTextFile("C:\Inetpub\wwwroot\fyp\ap.txt",1) do until objTextFile.AtEndOfStream strNextLine = objTextFile.Readline arr = split(strNextLine," ** ") dim sql sql = "INSERT INTO tracking_info(ap_id, signal_strength, mobile_id, other_info) VALUES('" & arr(i) & "', '" & arr(i+1) & "', '" & arr(i+2) & "', '" & Now() &"')" objConn.execute(sql) loop set fs=Server.CreateObject("Scripting.FileSystemObject") set tfile=fs.CreateTextFile("C:\Inetpub\wwwroot\fyp\ap.txt",1) tfile.WriteLine("") tfile.close set tfile=nothing set fs=nothing objConn.close set objConn = nothing set objFSO = nothing set objTextFile = nothing Set fso = CreateObject("Scripting.FileSystemObject") fso.DeleteFile "C:/Inetpub/wwwroot/fyp/ap.txt" %> <SCRIPT LANGUAGE="VBScript"> ' refresh the navigation folder opener.navFolderFromUpload "<%=request("strDir")%>","<%=request("txtBox")%>","<%=request("file")%>" self.close </SCRIPT> </BODY> </HTML> Problem Problem is whenever after 10 seconds there is no ap.txt in the C:\Inetput\wwwroot\fyp folder or there is nothing in the text file, the browser directs to error page where no auto-refreshing can be performed. • Question about program.asp How should I make program.asp redirect my browser to ANOTHER browser to display the messages "no text file detected or text file is empty”. • How should I design the other browser? How do I design the codes for this browser to display “no text file detected or text file is empty, it will keep refreshing until it detects the existence of the contents of ap.txt, and then redirect to program.asp to perform the functions. Anyone knows? Any references? |
|
#2
|
||||
|
||||
|
--moved to Programmers For Hire forum.
|
![]() |
| Viewing: ASP Free Forums > Other > Programmers for Hire > How do I design a browser to detect text file? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|