concrete5 provides an asset library helper, which makes it easy to add file support to your own custom forms and blocks. When used, the asset library helper creates a javascript area that is capable of launching the file manager, managing file permissions, etc…

Loading the Helper

$al = Loader::helper(‘concrete/asset_library’);

Methods

$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.

Recent Discussions on this Topic

Problem Choosing Image after Upload

If I upload an image using the "Asset Library" file selector. The image uploads correctly I enter any extra property bits and assign to any sets. I close or click update, and then am taken back to my filemanager. This is a blanket problem across my si…

Multiple asset library elements in block configuration

Hi, I am making a kind of slide show block and need some help with having multiple file selectors. The amount of slides is unknown they are added / removed using javascript. Each of the asset library elements has to have an ID so I am unsure of how to …