Yep found that out too - the almost correct advice is in Bradley's 
ColdFusion fast&easy web development book.

The code that worked (but only at the top level FTP folder) is as follows 
-- hope this helps.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<!--- Set the BaseDir var to null -- Bradley initially had it set to "ftp" 
which did not work -- other strings besides "ftp" also seemed to work -- go 
figure --->

<cfset BaseDir = "">

<cfparam name="TargetDir" default="#BaseDir#">

<cfif IsDefined("url.target")>
    <cfset TargetDir = url.target>
</cfif>

<cfftp action="OPEN"
       server="www.somewhere.org"
       username="thesite"
       password="xxxxxxxx"
       stoponerror="no"
       connection="northwind">
<cfset Success = cfftp.succeeded>

<cfif Success>

    <!-----------  This code and variations on the "directory" line item 
didn't seem to work
    <cfftp action="CHANGEDIR"
           stoponerror="Yes"
           directory="/COLAB/"
           connection="northwind">
    ------------->

<!------ This worked and the key seems to be the "." in the "directory" 
line item ---->
<!------ The other books had an asterik, or a slash asterik. ------>
<!------ Guess it may be a windows vs unix thing ------->
    <cfftp action="LISTDIR"
           stoponerror="Yes"
           name="ftpdir"
           directory="."
           connection="northwind">

    <cfftp action="putfile"
           stoponerror="Yes"
           remotefile="newdsp.TST"
 
          localfile="e:\inetpub\wwwroot\clients\lib-com.com\colab\ftp_do  
s\dsp5.txt"
           connection="northwind">

<html>
<head>
    <title>Get a Remote Directory Listing</title>
</head>

<body>

<cfif NOT Success>
    <cfoutput>Error: [#cfftp.errorcode#] #cfftp.errortext#</cfoutput>
    </body></html>
    <cfabort>
</cfif>

<h2>Get a Remote Directory Listing</h2>
<table width="100%">
<cfoutput query="ftpdir">
<tr>

<td><cfif IsDirectory>d<cfelse>&nbsp;</cfif></td>

  <td>
    <cfif IsDirectory>
      <a href="ftp-getd.cfm?target=#TargetDir#/#name#">#name#</a>
    <cfelse>
      <a href="ftp-getfile.cfm?path=#TargetDir#&fn=#name#">#name#</a>
    </cfif>
  </td>

  <td>#length#</td>

  <td>#DateFormat(LastModified)# #TimeFormat(LastModified)#</td>

</tr>
</cfoutput>
</table>
</body>
</html>


     ^
    / \__
   (    @\___
  /          O
 /    (_____/
/_____/
Whoof...
410-757-3487

-----Original Message-----
From:   Lonny Eckert [SMTP:[EMAIL PROTECTED]]
Sent:   Wednesday, March 21, 2001 11:26 AM
To:     CF-Talk
Subject:        RE: Mastering ColdFusion 4.5

Kristin,

I had trouble using the guidance for fetching a file directory listing from
an FTP server.  Used the on-line help.  You may want to make sure that that
section of the text is correct.


Regards,
Lonny Eckert
Hesta Corporation
[EMAIL PROTECTED]
Hesta 610-230-2500 x147
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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