web design and hosting
features and pricing my account customer support about ICG Link, Inc. contact ICG Link, Inc.

Form.pl: Uploading Files
Our form script is a powerful, yet easy-to-use tool that will make your web site more interactive and useful for your visitors. The script allows you to create a web page with fields that are filled out by a visitor and then perform various tasks with that information. When the form is submitted, the information can be sent by email to a recipient or recipients in any format you choose, it can be saved to a file in any format you choose and the script can send the visitor to a plain results page or one that presents the data as submitted or presents altered information based on any calculations or automatic decisions you may want to apply to the information. When used in combination with the search and replace scripts, you can even use this script to enter content you manage from a back office administration area.

Select the article that describes the form script functions you need.
  • The Basics: Send and format an email message, write to a file in a format of your choice, specify required fields, set up an error page.
  • Advanced Form Functions: Set and check cookies, perform calculations with built in math functions, manipulate text, use if - then logic, use a wide variety of preset values and more.
  • Upload Files (this article): upload one or several files with a single submission, resize image files on the fly, create image thumbnails at the same time and more.
  • Send Encrypted Mail: Send encrypted email messages with GnuPG.
  • Perform Secure Transactions: Use the form script on our secure server and enjoy useful features dedicated to e-commerce.
Features built into the form script allow users to upload files from a password protected folder to any folder in their web space. This might be useful to create a back-office administration area for non-technical people who do not wish to use ftp. The script will not work if it is made publicly available, so the first step is to create a folder such as /admin that will be password protected. You will then use our password management system to password protect your folder.

Next, you will upload an html file to your password protected folder with code following this example. Some of the hidden fields are optional as noted below:
<form action="/cgi-bin/form.pl" method="post" enctype="multipart/form-data">
<input type="hidden" name="f_directory" value="/pics">
<input type="hidden" name="f_index" value="1">
<input type="hidden" name="f_maxbytes" value="100000">
<input type="hidden" name="f_success" value="http://www.yourdomain.com/success.html">
<input type="file" name="file-to-upload-1">
<input type="submit" value="Upload File">
Options shown in the example are as follows:
  • f_success - the full URL of the success page
  • f_directory - the folder where you want your files to be uploaded starting in the www folder. For example /clients/pics would upload pictures to http://www.yourdomain.com/clients/pics. If f_directory is not included, the file will be uploaded to the folder from which the script is called (/admin in the example above).
  • f_maxbytes - set this variable to zero or simply do not include it to turn off this feature. Otherwise it sets the limit for file size. For example, to limit file size to 100k, you might enter 100000.
  • f_index - set to 0 (or not included) allows users to upload files named index.htm, index.html, index.cfm, etc. If you set this variable to 1, they can't.
  • f_thumb - set this to limit dimensions for a thumbnail image (_width_x_height_). Example: <input type="hidden" name="f_thumb" value="300x900"> - in this example, unless the picture being uploaded is more than three times taller than it is wide, the picure will be proportioinally shrunk (or expanded) to have a width of 300 pixels. If it is more than 3 times taller than it is wide, it will be shrunk (or expanded) proportionally to a height of 900. if you want to be SURE that one dimension is used and NOT the other, make the other a VERY high number....i.e. "300x90000".
  • type=file - you may upload as many files with a single submission as you need by changing the number at the end of file-to-upload-1, for example file-to-upload-2, etc.
Of course all the other useful features of form.pl work perfectly in combination with these.
ICG Link, Inc. 7003 Chadwick Drive, Suite 111, Brentwood, TN 37027