• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

12.2. Dealing with Files

The CFFILE tag handles all file manipulation that takes place on the local ColdFusion server. The CFFILE tag has three purposes. First, it makes it possible to upload files to the ColdFusion server via an HTML form. This means you can design forms that allow users to upload files from their machines directly to your ColdFusion server. This lets you create things such as web-based email clients, document management systems, and other applications that require users to upload files to your server. The second purpose of the CFFILE tag is to allow you to manipulate files located on your ColdFusion server. The CFFILE tag allows you to rename, move, copy, and delete files on the ColdFusion server. The final purpose of the CFFILE tag is to allow you to read, write, and append both text and binary files.

12.2.1. Uploading Files

Enabling file uploads is one of the more popular uses for the CFFILE tag. To do this, you first have to include a file input type in an HTML form. This allows a user to select a file from their system and post it along with the other form fields. When the form is submitted, the file is posted to the server/template specified in the ACTION attribute of the FORM tag. The receiving template then uses a CFFILE tag to process the uploaded file.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint