Skip to main content
June 5, 2006
Question

Page refreshing after CFFTP operation

  • June 5, 2006
  • 2 replies
  • 466 views
I am at my wits end with this....

OK here's what I am doing....

a simple cfftp getfile action to pull a file from a remote ftp server....This works
what I want to happen after that action is for the page to refresh itself (without the url variables that initiated the action)

Here's what happens...

The cfftp action runs without a hitch but the browser displays
"Internet explorer cannot display the page.........."

When the user clicks a link on the page, the page is executed again with a URL variable like so;
http://10.26.1.100/mpiadmin.cfm?ftp=yes

This instructs the page to run the cfftp action....and at the end I have a cflocation to reload the page without the url variable.
<cfif isdefined("url.ftp") and url.ftp is "yes">

<cfset thefile = #GetDirectoryFromPath(GetBaseTemplatePath())# & "load" & "\" & "Data" & "\" & "unit.fil">

<!--- Open an FTP Connection to HBOC Server in Dallas --->
<!--- Transfer Unit.fil file to DATA directory --->
<cfftp action = "getfile"
username = "---"
connection = "HBOC_Downtime"
password = "-------"
server = "---.---.---.---"
stopOnError = "Yes"
remotefile="/user/hbocsql/unit.fil"
localfile="#thefile#"
failifexists="no">

<!--- Close the FTP connection to HBOC Server in Dallas --->
<cfftp action = "close"
connection = "HBOC_Downtime"
stopOnError = "Yes">

<cflocation addtoken="no" url="mpiadmin.cfm">
</cfif>

Can anyone tell me why this is failing (meaning the page reload)?

Thanks,
-Jones
    This topic has been closed for replies.

    2 replies

    June 5, 2006
    That's what I'm doing... I am submitting mpiadmin.cfm to itself as mpiadmin.cfm?ftp=yes The ftp=yes is checked and if it exists and is "yes" it runs. Once it triggers the file transfer, I want the form to reload. This is not happening.
    Inspiring
    June 5, 2006
    You appear to be creating a negative out of a double positive. You are submiting the form to mpiadmin.cfm and then cflocating to mpiadmin.cfm from that same page. Do one or the other, but not both.
    June 6, 2006
    MPIADMIN.CFM is the form and the action page all in one. I present the form with mpiadmin.cfm, upon submission I process the form, and after processing present the form again. I should mention that this form ( the cfftp part) is not the only form on the page. After processing takes place I reload the page without the URL variable that initiated the desired action. I don't see it as a negative. In fact I look at it as I can use one template to handle what some would use more than that to handle. Also, this is the only problem I'm having on the page. Other forms will process as required and reload with no problems. It seems to be something with the fact that when the ftp process is triggered then Coldfusion moves to the reload section, that because the actual file transfer is not completed that it decides to NOT reload the page, rather it never loads the entire mpiadmin.cfm?ftp=yes page. Once it finally times out so to speak it loads the mpiadmin.cfm?ftp=yes page which for some reason throws the error. I hope this makes sense....
    Inspiring
    June 5, 2006
    Why do you need the page to refresh itself?
    June 5, 2006
    Refresh may not be the best word... Rather I want to reload the page after the cfftp action takes place so that the form is re-displayed to the user.
    Inspiring
    June 5, 2006
    A frequently used method of re-presenting the form is to "submit the form to itself". In other words, if your form page is abc.cfm, your form (cfform) tag would be:
    <form action="abc.cfm">

    You then add some logic at the top to see if you are dealing with a submitted form or not.

    However, your cflocation tag should also work, as long as you are not "submitting the form to itself"