Loading the Helper
$al = Loader::helper(‘concrete/asset_library’);
$al->file($formElementID, $formName, $chooseText, $fileObject = null)
Creates a concrete5 file element. Gives the element the ID $formElementID, and the form name $formName. This will be the name of the item in the $_REQUEST or $_POST array. (Note: the concrete5 file element does NOT post using $_FILES. It posts numerical file IDs of files already stored within the concrete5 file manager.)
$al->file(‘thumbnail’, ‘thumbnailFileID’, ‘Select Thumbnail’);
When the surrounding form is submitted, check $_POST[‘thumbnailFileID’] for a numerical file ID.
Optionally, a File object can be provided, and the form element will show that as initially selected.
$al->image($formElementID, $formName, $chooseText, $fileObject = null)
Exactly like file(), but restricts selection to image file types.