Upload multiple files within custom block
Permalink
Hi
I have created custom blocks for our website but I am looking at creating a block that has (upto) 6 files appended to it.
I have set up the db.xml to manage 6 separate files, but I cannot get the code correct to add them. Currently if I add a more than one file it overwrites the previous file (i.e. only one file).
I have searched the forums to no avail so any support would be greatly appreciated.
add.php
db.xml
I have created custom blocks for our website but I am looking at creating a block that has (upto) 6 files appended to it.
I have set up the db.xml to manage 6 separate files, but I cannot get the code correct to add them. Currently if I add a more than one file it overwrites the previous file (i.e. only one file).
I have searched the forums to no avail so any support would be greatly appreciated.
add.php
<?php $includeAssetLibrary = true; $al1 = Loader::helper('concrete/asset_library'); $al2 = Loader::helper('concrete/asset_library'); $al3 = Loader::helper('concrete/asset_library'); $al4 = Loader::helper('concrete/asset_library'); $al5 = Loader::helper('concrete/asset_library'); $al6 = Loader::helper('concrete/asset_library'); ?> <h2><?php echo t('Files to upload')?></h2> <!-- Consent Forms --> <p>Consent Form</p> <?php echo $al1->file('ccm-b-file', 'fID1', t('Choose File'), $bf);?> <!-- Risk Assessment --> <p>Risk Assessment</p>
Viewing 15 lines of 28 lines. View entire code block.
db.xml
<field name="fID1" type="I"></field> <field name="fID2" type="I"></field> <field name="fID3" type="I"></field> <field name="fID4" type="I"></field> <field name="fID5" type="I"></field> <field name="fID6" type="I"></field>
If that does not work (yet), add the 'fID1', 'fID2' etc to the $btExportFileColumns array in your controller.php file.
I also see you always pass $bf as an instance to the function. This should be all different instances of each file. So you probably have the same image everywhere I assume?