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])
- name|id: adds name and id attributes to the element (where id is optional)
- label: adds a label element to the label position
- required: if set to TRUE an image will be required
- attributes: adds other valid attributes to the element (as string or array)
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