SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Zealot easyrew's Avatar
    Join Date
    Nov 2001
    Location
    Milton Keynes, UK
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ColdFusion: CFFTP woes...

    I've been having "fun" with CFFTP. I have some code which transfers a ZIP file from one Win2k machine to another via FTP. The code is given the subdirectory for the remote machine - eg, "\maindir\subdir\". It opens an FTP session, then uses the "action=ExistsDir" option to determine if the directory exists. Based on the reply it will traverse the tree and create directories/subdirectories if neccessary.

    However - CFFTP has stopped replying to the "ExistsDir" request. I would expect CFFTP.ReturnValue to contain "yes" or "no" - but its empty.

    We have recently upgraded to Win2k and IIS5 (running CF5 by the way) - so I immediately assumed the problem was with that (although the code has worked since the upgrade). I ran the same code on our NT4 boxes (which also used to work) and that failed to reply to the "ExistsDir" request too.

    I have tried it with the following values for the directory to check:

    \maindir\subdir\
    maindir\subdir\
    maindir\subdir
    /maindir/subdir/
    maindir/subdir/
    maindir/subdir

    Have tried "passive=yes" and passive="no".

    Is there an option in IIS to disable checking that something exists?
    Is it case-sensitive?

    Any ideas - I've pretty much exhausted all options I could think of.

    Here's an example of the test code:

    Code:
    <cfset server = "myServer">
    <cfset user = "myUser">
    <cfset passwd = "myPass">
    <cfset dir = "\myDir\mySubDir\">
    
    <cfftp action="OPEN"
           server="#server#" 
           username="#user#"
           password="#passwd#"
           stoponerror="No"
           passive="No"
           connection="ftp"
           retrycount="3"
           timeout="30"> 
    	   
    <cfftp action="EXISTSDIR"
           stoponerror="No"
           directory="#dir#"
           connection="ftp">
    
    <cfftp action="CLOSE"
           stoponerror="No"
           connection="ftp">
    				   
    <cfoutput>
    Does the directory "#dir#" exist on #server#? <br>
    Answer: "#CFFTP.ReturnValue#"
    </cfoutput>
    Cheers guys...
    If a man stands alone in the forest
    and there's no woman around to hear him,
    is he still wrong?
    w: www.EasyRew.com

  2. #2
    SitePoint Guru nagrom's Avatar
    Join Date
    Jul 2001
    Location
    Western CT, USA
    Posts
    803
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    rich,

    are you using a custom 404 page?

    if so, it *could* be this:

    in the site's properties, on the home directory tab:
    click the configuration button
    click .cfm, click the edit button
    there is a 'check if file exists' box.

    i check it when i have a cfm custom 404 template, but sometimes run into this type of trouble with it, and have to uncheck it.

  3. #3
    SitePoint Zealot easyrew's Avatar
    Join Date
    Nov 2001
    Location
    Milton Keynes, UK
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for trying Nagrom...

    I figured out why my example code was failing consistently. Its because I'm a chump!

    If you look again at the code you'll see the problem, probably. I can't believe you didn't spot it first time nagrom

    I should have output the CFFTP.ReturnValue immediately after the "action=ExistsDir" command. Instead I then closed the FTP connection (being super-efficient) and it (the call to close the connection) returns an empty string into the CFFTP.ReturnValue variable.

    Argh! I now have the test code working and can concentrate on why the main application is failing at that point.

    I'm guessing that its related to the wrong slashes. In my tests it looks like the correct form for the Directory string is: /maindir/subdir (no trailing slash)

    Thanks for taking the time to look nagrom.
    If I have any other startling revelations I'll post them here.

    On a related note - is anyone aware of a filesize limit with FTP. For reasons that I won't go into here I need to FTP a 6.5gb (yes GB) file from one local server to another. When the file was about 4gb it worked fine - but it now fails somewhere in the middle (nicely vague). Just wondering...

    Rich
    If a man stands alone in the forest
    and there's no woman around to hear him,
    is he still wrong?
    w: www.EasyRew.com

  4. #4
    SitePoint Guru nagrom's Avatar
    Join Date
    Jul 2001
    Location
    Western CT, USA
    Posts
    803
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    doh!

    2nd question...uhh....6.5gb?

    put the hard-drive in the mail.

  5. #5
    SitePoint Zealot easyrew's Avatar
    Join Date
    Nov 2001
    Location
    Milton Keynes, UK
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yep - 6.5gb!

    Its all down to a server behind a firewall and not being able (or stupid enough!) to open the ports to allow the clever backup software to back it up. So instead, we're using NTBackup to a single file then FTPing that through the firewall to another server which is backed up. Bit of a nightmare...

    Thanks for the helpful(?) suggestion.

    Rich
    If a man stands alone in the forest
    and there's no woman around to hear him,
    is he still wrong?
    w: www.EasyRew.com

  6. #6
    SitePoint Guru nagrom's Avatar
    Join Date
    Jul 2001
    Location
    Western CT, USA
    Posts
    803
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    rich, i'm not sure if cfftp works this way, but i know cffile puts the file in memory and then writes it.

    cfftp probably not, because i imagine its using those old dos commands under the hood.
    and its using, well, the ftp protocol instead of http.

    heck, i'd go buy a tape drive for that machine. $200 (american, heh), you've probably already wasted a day on it...

  7. #7
    SitePoint Zealot easyrew's Avatar
    Join Date
    Nov 2001
    Location
    Milton Keynes, UK
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nagrom,

    I think I slightly confused things. My problem with CFFTP and the problem with the 6.5gb file were unrelated. The transfer of the 6.5gb file is done using a Win2k batch script. As for the tape drive suggestion - don't even go there!

    When I corrected my example code (see above) I realised that the "action=existsDir" command was returning "NO" even when the directory existed on the target server.

    The solution to the problem came after much trial and effort (and a period of gently rocking back and forth under my desk whimpering ). It turns out that the directory passed to CFFTP when using the "action=existsDir" is case sensitive.

    On one server, where the variable holding the dir name was created), the directory was /MainDir/SubDir and on the other it was /MainDir/Subdir (note the subtle difference). So when I was looking at both machines trying to work out the problem - both directories appeard to exists.

    I've never know Win2k or WinNT to be case sensitive before. Why suddenly start now?

    In my testing I noticed that if I have a directory called /MainDir/SubDir and try to change directory using CFFTP, if I pass the string "/mAINdIR/sUBdIR" it works. Likewise any other case arrangement works fine!

    Grr!!! - I love a challenge, but this one started to get me down. Anyhow - it works now. I'm off to fix another bug...

    Rich
    If a man stands alone in the forest
    and there's no woman around to hear him,
    is he still wrong?
    w: www.EasyRew.com

  8. #8
    SitePoint Guru nagrom's Avatar
    Join Date
    Jul 2001
    Location
    Western CT, USA
    Posts
    803
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for the details rich...that *is* interesting


Bookmarks

Posting Permissions

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