BoltWire is a FREE content management system written in PHP.

Its innovative architecture combined with best-in-class forms processing makes it ideal for creating complex, interactive, web applications fast...




Handbook > Forms > File Upload

The file (upload) input field allows you to select a file from your computer and upload it to the server. Most of the file handling and management on the back-end is done by the upload command, but the input field is what actually picks and uploads the file. Here's how it looks:

[file upload required=true][submit]
[command warn]

The input type is "file" and the field name is "upload". Normally this is all you need. For more information about file uploads and how they work, see the upload command.

Additional Parameters

There are no useful BoltWire parameters for this input type, as it does not normally return a value that BoltWire can evaluate, but rather sends the file as an attachment to the form. BoltWire's required parameter checks to see whether or not there is an attached file with a length greater than 0.

The required parameter conflicts with the HTML5 parameter, which is allowed. That is, if you set required=true, HTML5 browsers will block form submission--before BoltWire has a chance to. Older browsers will not recognize the parameter and ignore it, allowing BoltWire's check to kick in. If you want to rely fully on BoltWire so all users have the same experience, you can reset the HTML parameters allowed in config.php to not include "required". You can see the default value in variables.php.

By default the following html parameters are allowed:

name, class, id, style, disabled, autofocus, required

To override the default message created when a form fails some input check, set msg to the value you wish, or set it to false to turn it off.

For information about how to insert javascript into a form element, please see that tutorial.