Form Tools: generic form processing, storage and access script
Configuring Form Tools for File Uploads Tutorial Index

Overview

This quick tutorial explains how to configure Form Tools to allow your form to contain file upload fields. For simplicity, the tutorial is split into two sections: adding it through the Add Form process, and manually adding them after the form is complete. In both cases a little manual configuration is required. The references section contains a link to the help doc for further information.

Adding a file upload field through the Add Form process

This is very simple and works exactly the same way as the adding other fields. The only things you need to remember are:

  1. Be sure to upload a file with your original test submission. If this isn't done, you'll need to manually add the field after uploading
  2. When specifying the field sizes, always indicate the field size to be "Medium < 256 chars". This allocates 256 characters in the database to store the filenames.
  3. At this point, you've created a new form field ready for storing uploaded filenames in the database. Now you need to fine-tune it.
  4. Click on the Display tab. Locate your new field, and change the Field Type to "file". Click the UPDATE button. You will now see a clickable Options link for that field. Click it.
  5. In this page, you need to specify the upload folder and what file types can be uploaded through the field. Be sure to click the "Test Folder Permissions" button and the "Confirm Folder-URL Match" buttons. These two buttons were added to make the process of adding a form field as pain-free as possible. They confirm that (a) the folder you specified exists and has the correct permissions to upload files to, and (b) that the URL you've entered matches the folder.
  6. Lastly, if you are using the optional auto-emailing, you will need to go to the Emails tab and update each of the templates. This is required in order to provide a link to the file in the emails.

How to manually set up a file upload field

As with other form fields, file fields can be specified when you first add the form to Form Tools through a test submission, or afterwards by manually adding the field on the Advanced tab of the Edit Form page. In both cases, you will need to edit the field to indicate the upload folder and the permitted file upload types.

To configure Form Tools to store a new file upload field, just follow these steps:

  1. First, verify that your form has the following attribute: <form ... enctype="multipart/form-data">. This lets the server know that the information being sent with the form data may contain files. You will not be able to upload files without adding this attribute.
  2. Now log into Form Tools. Edit the form and go the Advanced tab.
  3. Click the Add Field button.
  4. Enter in the following values:
    • Display Name: e.g. "Image File" - or some descriptive name that clearly identifies what the file field is about.
    • For Field Size, select "Medium (<256 chars)". This will allocate 256 characters in the database to store the file name for each submission.
    • Form Field Name: enter the name of your file upload form field. This is what you entered for the name attribute of the file upload form field, e.g. <input type="file" name="myfile" />. Note that this field is case-sensitive.
    • Database Column Name: enter a unique string made up of only alphanumeric characters, e.g. imagefile1. Note that it can't start with a number! You can check that the name isn't already taken by looking in the Existing Column Names dropdown list to the right of the field.
    • The other values are optional.
  5. At this point, you've created a new form field ready for storing uploaded filenames in the database. Now you need to fine-tune it.
  6. Click on the Display tab. Locate your new field, and change the Field Type to "file". Click the UPDATE button. You will now see a clickable Options link for that field. Click it.
  7. In this page, you need to specify the upload folder and what file types can be uploaded through the field. Be sure to click the "Test Folder Permissions" button and the "Confirm Folder-URL Match" buttons. These two buttons were added to make the process of adding a form field as pain-free as possible. They confirm that (a) the folder you specified exists and has the correct permissions to upload files to, and (b) that the URL you've entered matches the folder.
  8. Lastly, if you are using the optional auto-emailing, you will need to go to the Emails tab and update each of the templates. This is required in order to provide a link to the file in the emails.

References

For further information, you may wish to read the Adding / Editing Field Options section of the user documentation.