In this section you will build the NeXTensio list's counterpart - the NeXTensio form. It allows performing all of the actions set as links in the list: insert, update and delete, on a single file or more of them at once. Besides the regular form, you will have to add some features that are file-specific:
The file upload capability - this is used when adding or editing a record, to allow uploading the file, and not only storing its name in the database.
The file delete capability - when a record is deleted, the file it points to should be removed from the disk as well.
To create the form, follow the next steps:
Open the form page in Dreamweaver.
First, add the NeXTensio form components on page. To do so, start the Create NeXTensio Form Wizard from the MX Kollection tab of the Insert panel.
Configure each step of the wizard as follows:
In the first step, thanks to the user interface
persistence you do not need to change a thing. The connection, table name
and primary key are remembered from the Create
NeXTensio List Wizard.

In the second step, you must configure what
kind of form fields you will use for each table column. To change the
properties for a field, select the table column in the grid, and then
use the elements displayed below the grid. For the filename, in the Display as drop-down menu, select
File field. You must do this, in order to allow uploading files
later on. The Submit as drop-down value will
change as well, allowing only the File submit
type. Also, set the description column to use a text
area.

The third step of the wizard allows applying validation rules on each field. It is available only if you have MX Form Validation installed, as a separate product, or as part of a bundle. You can safely skip this step, since none of the files requires any particular validation options.
In the last step, similar to the list wizard,
you can set options related to the form: whether to duplicate buttons
or not, how to display records when editing more than one etc. When done,
click on the Finish button to close the
user interface.

Now the NeXTensio form is on the page, and you can begin to enhance it, in order to work with files: the upload file and delete file options.
First, the upload file
capability: this will be implemented using the Upload
File trigger. Before applying it, select the file field in the
form on page:

Now apply the Upload File server behavior from the Server Behaviors tab > MX Kollection > File Upload. Configure each tab of the user interface that opens as follows:
In the Basic
tab, select the form field that allows selecting the file. Since you applied
the server behavior while the Filename field was selected, the drop-down
already contains its name. Next select the table column to save the names
into (filename_doc). And last, select the
folder where to place the uploaded files. This should be already filled
with the value used when applying the file download options.

In the File tab,
set the maximum allowed file size, as well as the allowed extensions.
To add an extension, simply click on the Plus (+)
button on top of the list, and enter it (e.g. add the *.doc extension
too). You can also set renaming rules.

Now click on the OK button to close the user interface and apply the server behavior. The trigger will automatically register itself, and execute on both the insert and update transactions on page.
Next, you must add to the existing Delete Transaction (which removes database entries) the capability of removing files from the server as well. This is done in order to maintain the correlation between the database entries and the existing files, and not to have orphan files.
To add this option, simply apply the Delete File server behavior from the Server Behaviors tab > MX Kollection > File Upload. The dialog box that opens should be already filled by the user interface persistence. If not, select the table column storing the file name, and the folder where the files are located. Then click on OK to close the dialog box.
At this point, you have a fully functional file management module at your disposal. So, it's time to save the pages, upload the entire site to the server, and give it a try. In the list, click the Add new button to open the form and add new files. Fill in the form options and add the new record:

If you need to add more than one file at a time, simply select 3 or 6 in the drop-down next to the Insert button. Or read the How to on changing the number of records you can add at a time. Then simply enter the description and browse for the files in each of the fields. When you click on Insert, all files and records will be added to the server (records into the database, and files are uploaded to the specified folder).
