|
Division of Information Technology
Web Publishing @ SFSU CGIFILE |
CGIFILE uses a template and ACTION like CGIEMAIL, but appends information to a file rather than mailing it. These directions assume that you have already created a web page form and template file using CGIEMAIL. If not, please review the Forms and CGIEMAIL documentation for directions on how to create these files.
CGIFILE uses the same reserved words as CGIEMAIL.
CGIFILE requires a file called "incoming.txt". The incoming.txt file stores the responses submitted by the form in the format specified in the template file.
A new directory needs to be created for files used by CGIFILE (Later, we will give this directory write access so data can be written to the incoming.txt file). To avoid giving users access to write to your other files, these files need to be stored in a seperate directory To create this new directory you will need to log into your account using a Telnet program
apollo% cd public_html
In this example, the directory is called "feedback".
apollo% mkdir feedback
Using the CGIEMAIL example, move the web page form "feedback.htm" and template file "feedback.txt" stored in the public_html directory to the new directory "feedback". This will need to be done in two steps.
apollo% cp feedback.htm feedback
apollo% cp feedback.txt feedback
apollo% fs setacl feedback system:anyuser rwl
apollo% cd feedback
apollo% pico -w feedback.txt
The contents of the cgiemail template file look like this. The results are listed below with headings so the E-mail will be readable.:
From: [email]
To: userid@sfsu.edu
Subject: Sample Questionnaire
Group: [group]
Year: [year]
Term: [term]
Major: [major]
My comments: [comments]
Change the cgifile template file to look like this. The results here are shown without headings -- the data is comma delimited with a single carriage return at the end of the line so it can easily be imported to another program. In this example commas are used however if the user enters commas in the text area of the form it may result in errors when importing the data into a database or spreadsheet. You can use other special characters as delimiters.
[email],[group],[year],[term],[major],[comments]
<form METHOD="POST" ACTION="/cgi-bin/cgifile/~accountname/feedback.txt">
In the CGIEMAIL example, the web page form is called "feedback.htm".
apollo% pico -w feedback.htm
Using the down arrow key, scroll down until you see code similar to the following:
<form METHOD="POST" ACTION="/cgi-bin/cgiemail/~accountname/feedback.txt">
Edit the FORM tag to point to CGIFILE:
<form METHOD="POST" ACTION="/cgi-bin/cgifile/~accountname/feedback/feedback.txt">
Also, check the following:
apollo% touch incoming.txt
Step 1: apollo% rm incoming.txt
Step 2: apollo% touch incoming.txt
user-email@sfsu.edu,student,2000,spring,business,user-comments
user-email@sfsu.edu,student,2000,spring,business,user-comments
Home
Search
Need Help?
1600 Holloway Avenue, San Francisco, CA 94132 (415) 338-1111
Last modified May 14, 2002 by the Web Team