Creating Forms > About form fields > Allowing visitors to upload a file to your server |
Allowing visitors to upload a file to your server
In some cases the information you need from the visitors to your site may be too complicated to respond to in a text field. You may want visitors to send an entire file to your server, for example a nicely formatted resume, a graphics file, or some other document. You can set up a file field in a form to accomplish this task.
A file field looks like other text fields except it also contains a Browse button. A user can type the path to the file they're sending or use the Browse button to locate and select the document they're sending.
To use a file field, the form Method must be set to POST. Visitors post a file to the address you set up in the form's Action field.
Note: Confirm with your server's administrator that anonymous file uploads are allowed before using the file field. If you insert a file field with Dreamweaver, you must manually insert ENCTYPE="multipart/form-data" into the form tag to ensure that the file is encoded properly.
To create a file field in a form:
| 1 | Click the form outline to select the form, then in the Property inspector set the form Method to POST. |
| 2 | Place the insertion point inside the form outline, then do one of the following: |
| Choose Insert > Form Object > File Field. | |
| In the Objects panel's Forms category, click the Insert File Field icon. | |
| A file field appears in the document. | |
| 3 | In the Property inspector's FileField Name field, type a name for the file field object. |
| 4 | In the Char Width field, type a number to set the maximum number of characters you want the field to display. |
| 5 | In the Max Char field, type a number to set the maximum number of characters the field will hold. |