Chapter 11: Using the cffile Tag to Upload a File


Instructions for Project Execution

This section describes the detailed instructions to execute the application code provided with this book.

Steps to Create the Database

Perform the following steps to create the database and tables:

  1. Choose Start, Programs, Microsoft SQL Server, Query Analyzer. The Connect to SQL Server dialog box appears.

  2. Provide the name of the SQL Server. Then provide the user authentication information and click OK.

  3. Ensure that you are connected to the Master database. If you are not connected to the Master database, select it from the Database drop-down list.

  4. Chose File, Open.

  5. In the Open Query File dialog box, select Project2.sql. This script creates the KnowledgeBank database and two tables: Articles and Logins. If the SQL Server is installed in C:\, you do not need to modify the script. If the SQL Server is installed in any other path, modify the database path in the script.

  6. Click the Execute button on the toolbar to execute Project2.sql. This creates the database and the tables.

Perform the following steps to insert the data into the Articles and Logins tables:

  1. In the Query Analyzer, open the InsertLoginData.sql script. Ensure that when this script is executed, the current database is KnowledgeBank.

  2. Run the script. The InsertLoginData.sql script only fills the data and needs the table and database to be in place, so it should be executed after step 1.

The login that the script creates by default is user1 and the password is userone. The Directory name for user1 is userone, the Status is Active, and Delete Permission is Y.

The second record is for admin and the password is admin. The Directory name for admin is Admin, the Status is Active, and Delete Permission is Y.

Steps to Test the Application in ColdFusion MX

Create the data source as follows:

  1. Start ColdFusion MX Administrator. This is usually located at http://localhost/CFIDE/Administrator/index.cfm, but the location can be different as per the setup.

  2. Provide the password. The main screen appears.

  3. Navigate to data sources under the Data and Services section.

  4. Create a data source named KnowledgeBank for SQL Server.

Test the application as follows:

  1. Create a directory named ProjectTwo under the wwwroot directory on the Web server.

  2. Copy all the .cfm files in the ProjectTwo directory.

  3. Start the browser and open the login.cfm page (http://hostname/ProjectTwo/login.cfm).

  4. Create a directory C:\KnowledgeBank to store the user activity log files. Create the directory userone under C:\inetpub\wwwroot\ProjectTwo. The files for userone will be uploaded to this directory. The application also assumes the Web server to be installed in C:\.

Server-side technologies, such as ColdFusion or ASP, allow you to manage files on the server. ColdFusion implements file management with the CFML <cffile> tag, which you can use to move, copy, edit, or delete files on the Web server. You can use the <cffile> tag to upload files from a Web browser to a server.

In this chapter, you'll learn how to use the <cffile> tag to perform various file management operations on the server.




Macromedia ColdFusion MX. Professional Projects
ColdFusion MX Professional Projects
ISBN: 1592000126
EAN: 2147483647
Year: 2002
Pages: 200

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net