Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Feb 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Internet Explorer Use Java to list files in a directory and then full into an iframe>

    Hello and thank you in advance for your time!
    I am building a page that will display a file in an iframe.
    The problem is that the files won't necessarily be static.
    We are collecting weather data at 1 min. intervals which is saved into a flat file. I will be uploading these files (and re-uploading at set intervals) into a set directory with a naming scheme of Feb12log.* (type of file doesn't really matter. could be .txt, .csv, .xls) but the name will change corresponding with the month & year: {MMM}{DD}log.{ext}. Each month, a new file is created
    I can successfully pull a file into an iframe. I can build a drop box and a static list of files (File1, File2, File3 etc). I am pretty sure that I can build a search box in the page that will parse the information in the iframe (Ctrl+F would work as well I guess). Hopefully this is enough background info.
    Instead of building a page for each new month ad nauseam, I would love to be able to pull a list of files currently in the upload directory into a dropdown box and when a file is selected, have it display in an iframe on the same page. The ability to be able to search the page would be awesome.

    I am not looking for a handout, and I appreciate any input at all. My questions are: 1. Is this possible? Or should I resign myself to manually creating new pages every month? 2. Would anyone be able give me a nudge in the correct direction?
    Thanks again!
    M

  • #2
    New to the CF scene
    Join Date
    Feb 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I'm slowly making progress.

    So I can pull a drop down from an array:

    Code:
    <script language="javascript">
    
    function optionSel(selectbox,text,value )
    {
    	var optn = document.createElement("OPTION");
    	optn.text = text;
    	optn.value = value;
    	selectbox.options.add(optn);
    }
    
    function Option_list(selectbox){
    var month = new Array("Jan12","Feb12","Mar12","Apr12","May12","Jun12","Jul12","Aug12","Sep12","Oct12","Nov12","Dec12");
    for (var i=0; i < month.length;++i){
    
    optionSel(document.drop_list.Month_list, month[i], month[i]);
    }
    }
    </script>
    </head>
    
    <body onLoad="Option_list()";>
    	<FORM name="drop_list" action="yourpage.php" method="POST" >
    		
    		<SELECT  NAME="Month_list">
    			<Option value="" >Month list</option>
    		</SELECT>
    	</form>
    </body>
    And I have figured out how to pull multiple links into a target iFrame:

    Code:
    <html>
    <head>
    <TITLE>Site Current Month Totals</TITLE>
    	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
    </HEAD>
    <TABLE ALIGN=Left BORDER=1 BGCOLOR="#80FF00">
    <TR>
    <TD><H4>Monthly Totals</H4>
    
    
    <UL>
    <LI><A HREF="Jan12log.txt" TARGET="DisplayWindow">Document 1</A>
    <LI><A HREF="Feb12log.txt" TARGET="DisplayWindow">Document 2</A>
    <LI><A HREF="Mar12log.txt" TARGET="DisplayWindow">Document 3</A>
    </UL>
    
    <IFRAME 
        SRC="VerCurMonth.htm"
        NAME="DisplayWindow"
        WIDTH=1024 HEIGHT=480>
    </IFRAME></TD>
    </TR></TABLE>
    		
    </BODY>
    </HTML>
    Does anyone have an idea for code for a recursive search that can read a directory into an array? It could be a server side script.
    If I can figure that out, and figure how to tie it all together, the only thing left is to format the directory list as links and it should be good.
    Thoughts?
    Again, I would be very thankful for any tips.
    M

  • #3
    New to the CF scene
    Join Date
    Feb 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Anybody Have any thoughts?

    I apologize for the bump.

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Are you sure your language in use here is Java? all of the code you have here is Javascript and the processing language is PHP. If the file scan is on the server, this given the code you have, would be a PHP task. If its local, it would be Javascript, but I don't know what type of control there is in place to prevent iteration of filesystem (I'd guess that it would be denied local).

    If its Java, I'm not sure how much help you'll find here. Unfortunately, I'm am probably among the more versed in JSP, and I haven't used it in over 6 years with no intention of ever touching it again.

  • #5
    New to the CF scene
    Join Date
    Feb 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    @Fou-Lu,
    That was a mistype in the title.
    Truly, I am not picky on what language or process that is used to get the desired results. Thus far I am just piecing together snippets that I have found on the web.
    The restraints can be as liberal as needed. (it is a local iis 7 server on an intranet, which is used to display weather data) Although I would like to keep close to best practice on the security side, I am willing to loosen as needed to get this done.
    Any thoughts on how it might be accomplished (in any language)?
    Thank you in advance.

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Pretty much any language is capable of scanning a directory. Reading on a client cannot be done without a client language, and reading from a server takes a server language. I'd bet that JS itself could not read the filesystem of the client. Java itself can have an app written to perform this task. If its already on the server, then your processing language there would scan and show as necessary.
    Web processing languages job is to dynamically generate content from either changing information or from user input. So sure you can set this up to do what you want. But you do need to choose the language you are planning to use first; JSP requires a JSP compatible server, ASP.NET would require IIS, PHP is pretty much fair game anywhere as is Perl. All of these languages can iterate a directory and choose files if you provide it something to compare against so long as they are on the server itself.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •