Form Generation Library


Image Upload Element

The following method will add a file upload element to the form utilizing the form_upload() form helper function.

iupload (string name|id [, string label, bool required, string|array attributes])

Note: This method will automatically include the attribute parameter "allowed_types=jpg|png|gif" for your convenience.

Usage Example

// assuming that $nameasid = TRUE was set in the config file
// so we don't need to worry about supplying an element id


$this->form->upload('img', 'Upload Image')
will produce <label for="img">Upload Image</label><input type="img" name="img" id="img" /> and will only allow .jpg, .png and .gif files