|
ColdFusion Home
Basic ColdFusionIntroductionColdFusion Installation ColdFusion Editors ColdFusion Syntax ColdFusion Includes ColdFusion Variables ColdFusion Variable Types ColdFusion If Statements ColdFusion Loops ColdFusion Datasource ColdFusion Database Queries ColdFusion Lists ColdFusion Arrays ColdFusion Redirect ColdFusion Debugging ColdFusion Error Handling Advanced ColdFusionColdFusion MailColdFusion Functions ColdFusion Components ColdFusion Web Services ColdFusion Upload File ColdFusion Read File ColdFusion Write File ColdFusion Append File ColdFusion Rename File ColdFusion Copy File ColdFusion Move File ColdFusion Delete File Cffile Parameters Using cffile Parameters ColdFusion FTP (cfftp) cfftp Cached Connections ColdFusion HTTP (cfhttp) ColdFusion Query of Queries ColdFusion Charts ColdFusion Summary ColdFusion AdminCF AdministratorCF Archive and Deploy CF Scheduled Tasks CF Mini Tutorial ColdFusion BooksColdFusion MX BibleMacromedia ColdFusion MX 7 Web Application Construction Kit FREE Hosting!With every domain name you register with ZappyHost, you get FREE hosting.$1.99 Domain NamesWith every new non-domain purchase thru ZappyHost, you get a domain name for only $1.99. |
cfftp - Cached ConnectionsIn the previous lesson, we covered some basic FTP actions using ColdFusion's cfftp tag. By default, ColdFusion opened the FTP connection for us, then closed it when the template finished executing. Therefore, each one of those actions required a new connection to be created. This is fine if you only want to perform one action. But what if you want to perform multiple actions? Say you want to list a directory, copy a file, then list the directory again. Wouldn't it be more efficient to open the connection once, perform all tasks, then close the connection once everything has been done? You need to cache your connection! The cfftp tag's action attribute accepts both open and close as possible values. Using action="open" opens the connection, action="close" closes it. When you open the connection, you name it. That way, you can use this connection again and again simply by referring to its name.
Depending on the contents of the directory, the above code might result in something like this:
FTP over Multiple PagesIf your application requires the user to perform FTP operations across multiple pages, you can add the connection to the session scope by creating it as as a session variable. For example:
Enjoy this website?
Oh, and thank you for supporting Quackit! |
Need Content for your Website?Get unique, quality digital content for your website. You can even earn money by reselling it!Includes:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||