You need some sort of recursive directory scan, I did almost the exact same
thing a few weeks back.

Cut and paste them, the set the basedir param to where you want to begin the
dir scan, dont do the root of C: as it will take forever ;-)

Clicking any dir name should view the files in that dir, you could then
downlaod them or use cffile to do almost anything to them.


test1.cfm
-----------------------

<script language="JavaScript" type="text/javascript">
function browse(x){
        document.dirselect.dir.value = x;
        document.dirselect.submit();
}
</script>
<cfsilent>
<cfparam name="basedir" default="d:\sites\WeirValve\public\">
<cf_test basedir ="#basedir#">
</cfsilent>

<cfoutput query="request.filelist">
<a href="##"
onclick="browse('#urlencodedformat(FileName)#')">#FileName#</a><br>
</cfoutput>

<cfparam name="form.dir" default="#basedir#">
<form action="test1.cfm" method="post" name="dirselect">
<cfoutput><input type="Hidden" name="dir" value="#form.dir#"></cfoutput>
</form>

<hr>
Files in <cfoutput>#urldecode(form.dir)#</cfoutput>
<br>
<hr>

<cfdirectory action="LIST" directory="#urldecode(form.dir)#" name="files">
<cfoutput query="files">
<cfif type is "File">#name# | #size# bytes<br></cfif>
</cfoutput>

-----------------------


test.cfm
-----------------------
<cfparam name="request.filelist" default="#QueryNew('Filename')#">
<cfdirectory action="LIST" directory="#attributes.basedir#" name="list">
<cfloop query="list">
        <cfif type is "dir" and  not ( name is "." or name is ".." )>
                <cfscript>
                        QueryAddRow(request.filelist);
        
QuerySetCell(request.filelist,"FileName","#attributes.basedir##name#");
                </cfscript>
                <cf_test basedir = "#attributes.basedir##name#\">
        </cfif>
</cfloop>
-----------------------



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 05 July 2001 19:59
To: CF-Talk
Subject: Re: Is this possible?



I have a directory tree listing. For example,

d:\
test1
    |- subdir1
    |- subdir2
test2
    |- subdir1
    |- subdir2
test3
    |- temp1
    |- temp2
test4

Above this I have a <CFFORM with a INPUT box and a submit button.

If the user goes into the following directory test2...subdir2, I want them 
to be able to
enter in another directory by just typing "temp2" in the INPUT box, click 
on the "go" button and be taken
right to that directory even though that directory may not be listing 
(expanded) above.

I'm not sure how to go about this?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to